Have you ever been frustrated by getting unwanted result from Tableau filters? Count me in and follow me along as you may not know about Context Filter.

Dataset used in this blog: (you can download and explore it by yourself too)


Our desired output: to display top 10 sale people by sale for each region when we select a specific region.

This blog will explore how Tableau understands the order of filter when we add 2 dimension filters to the Filter Card.

Option 1: Just add needed filters

First, show the top 10 Sale person by Sale:

Add Region in Filter and show filter:

Notice how for region Central Tableau only shows 2 sale people? If you keep going you will see for East, there will be 7 sale people and for West there will be 1 sale person. That is the total of 10, our top 10 sale people by sale for the whole data set. This is because Tableau interpreted our command for filters as applying both filters simultaneously, to the entire data set. This has not met our goal of displaying top 10 sale people by sale for each region when we select a specific region.

Our desired output can be achieved if Tableau filter out the data set to each region first, and then filter out the top 10 sale people by their sale. There is an order of filters here that needs to be understood by Tableau.

Context filter is the answer here. Remember how in the previous blog, I have said Context filter can be used to force the order of filtering in Tableau.

Option 2: Using Context Filter

I recommend you duplicate the previous output sheet, and then apply context filter to region in the new sheet, so you could compare the results later on to understand the difference.

Now if you compare the result of each region to the previous output, you will notice the difference, for each region we have the top 10 sale people in that region displayed. If you also compare them to the top 10 sale people of the entire data set, you will see there are sale people who are not in the top 10 of all regions. We have successfully made Tableau understand the orders of filter that we want it to process, by using Context Filter.

In summary

Tableau reads: Apply both filters for me simultaneously.

Tableau reads: Apply Region filter first, then apply filter of Top 10 Sale people by Sale.

I hope this will help you to understand more about Context filter and to be able to achieve your desired output from Tableau filtering.

Thanks for reading. I would love to hear back from you about this blog, or anything data related really 😊.


The Data School
Author: The Data School