Making a Secondary Filter Dependent on a Primary Filter in Tableau

by Adrien Sourdille

Here is a quick blog explaining why and how you might make a secondary filter dependent on a primary filter.

Why?

When filtering a dataset by two different values, you might want to drill down into a specific part of your dataset first before filtering further with a secondary filter. By making your second filter dependent on the first one, you are able to select the values that interest you directly from your filtered dataset hence limiting the number of values you can select from to the ones that are of real interest to you. This might save you a lot of scrolling time if your second filter contains a lot of values, and it might also make more sense to the final users of your dashboard as you will no longer have unusable values in your second filter.

As an example, take the shots taken by each NBA player in the 2017-2018 Playoffs. During that playoff, a total of 8959 shots were taken by 199 players belonging to 16 different teams. If, for instance, you wanted to find and visualize the shots taken by Lebron James with a single filter, you would need to scroll down the list of all the NBA players that played during these playoffs and find "Lebron James".

This process would probably be long and tedious. Now imagine having to individually select the members of an entire team... In that case, your first intuition would probably be to add a team filter (and you would be right).

However, you can now see that, even though we managed to filter the data to the shots taken by the Cleveland Cavaliers team, the Player Name filter still contains the name of every NBA player in the league.

This is not ideal because further filtering would imply you going through the painstaking process of looking for individual players of the Cleveland team in the full list of 199 NBA players. To avoid this hassle, consider making the secondary player filter dependent on the primary player name filter. By doing so, you will be able to select entire teams or players within that team very easily.

How?

To do so, simply Open the drop-down menu for the secondary filter and select Only Relevant Values.

Here you have it! I hope this blog was useful, and if you want to take a look at what I ended up doing with this NBA playoff dataset do not hesitate to have a look at my tableau public profile.