Tableau Filter on field which contains MAX of another field

0 votes
I have a table in Tableau that contains football teams, their top goal scorers and the number of goals players scored. I would like to filter the table to show the team which has the player who has scored the most goals.

For example, if my table has Team A and Team B, and Team B has the player which has scored the most goals out of every player (in all the teams), then I would like the filter to include only Team B (but show every player in Team B).
Sep 11, 2018 in Tableau by Naruto
• 710 points
47 views

1 answer to this question.

0 votes

This is a good use case for a top filter.

  1. Place Team on the filter shelf.

  2. When defining the filter, choose the Top tab.

  3. Select By field, Top 1, Number of Goals and Max

This tells Tableau to determine the maximum value for the [Number of Goals] field for each Team, and then filter to only include the Team with the top value.

In SQL, this typically leads to a HAVING clause.

The only downside is if two teams tie for the top position, I believe you will only see one of them in that case.

If that case is important to you, you can get a similar effect using a table calc to rank teams by their max [Number of Goals], setting the tie breaking rule of your choice for the quick table calc, and then using that calc on the filter shelf to only show teams with the top rank. This will show multiple teams if they are tied for top rank.

The table calc approach is more flexible but can be less efficient, especially for large data sets, since the data is fetched from the data source to Tableau for the ranking calculation, and then only some of it is displayed. (Table calc come very late in the processing pipeline) The top filter approach performs the calculations and filters at the data source, and only sends the filtered results back to the Tableau client.

answered Sep 11, 2018 by Nitish
• 630 points

Related Questions In Tableau

0 votes
0 answers

How can I sort date field in presence of another date field in Tableau?

Goal: Sort the new ship date in ...READ MORE

Apr 10, 2018 in Tableau by ghost
• 1,790 points
104 views
0 votes
1 answer

Is it possible to join tables on the basis of some calculated field in Tableau?

@Ammy999, You can not perform join in ...READ MORE

answered May 16, 2018 in Tableau by Mathew1810
88 views
0 votes
1 answer

How to color code cells of a column based on the text value in Tableau

You can use the following steps to ...READ MORE

answered Mar 27, 2018 in Tableau by Atul
• 10,240 points
1,574 views
0 votes
1 answer

How to hide measures on a Tableau filter?

Number of Records is just a predefined ...READ MORE

answered Jul 10, 2018 in Tableau by Atul
• 5,530 points
72 views
0 votes
1 answer

Reset filters in Tableau

I understood your question (I hope so!). ...READ MORE

answered Mar 29, 2018 in Tableau by QueenBee
• 1,810 points
482 views
0 votes
1 answer

How to create a global filter

Assuming you have created a dashboard already, ...READ MORE

answered Apr 12, 2018 in Tableau by QueenBee
• 1,810 points
39 views
0 votes
1 answer

How can I create a second sheet which is filtered to 8 days ago,

Following are the steps you can follow: Create ...READ MORE

answered Jul 11, 2018 in Tableau by Atul
• 5,530 points
34 views
0 votes
1 answer

How to filter/parameter for different date ranges

Steps: Create a parameter control that the users ...READ MORE

answered Jun 20, 2018 in Tableau by Atul
• 10,240 points
513 views
0 votes
1 answer

How to create a filter based on date range?

You can use this code snippet in ...READ MORE

answered Aug 7, 2018 in Tableau by Nitish
• 630 points
41 views
0 votes
1 answer

How to reduce time taken to compute filters in Tableau?

You can apply the context filtering before ...READ MORE

answered Aug 20, 2018 in Tableau by Nitish
• 630 points
45 views