How to Implement Context Filters in Tableau

Last updated on Apr 26,2024 3.1K Views

How to Implement Context Filters in Tableau

edureka.co

Creating Filters is a very important aspect of Tableau. In this article, we will understand Context Filters in Tableau in the following order:

 

What are Context Filters in Tableau?

Generally, all the filters that you set in Tableau are independently computed. Basically what it means is that each filter accesses all rows in your data source without regard to other filters. A context filter is like an independent filter. Any other filter that is set is termed as a dependent filter due to the fact that they only process the data that passes through the context filter.

Now, you can deploy a context filter to achieve either of the following;

For instance, if you’re in charge of food products for a really large grocery chain. Your task is to find the top 10  snack bars by profitability for all stores. Obviously, the data is enormous. Here, you can set a context filter to include only snack bars and create a top 10 filter by profit as a dependent filter. This would process only the data that passes through the context filter.

How to Create Context Filters in Tableau

To build a context filter follow the given steps below;

  1. Appear at the top of the Filters shelf.
  2. Are identified by a grey color on the Filters shelf.
  3. It cannot be rearranged on the shelf.

 

As shown in the image above, the Ship Mode dimension is set to be the context for a view, and the Region filter is only computed using the data that passes through Ship Mode.

You can make modifications to a context filter by doing one of the following things;

Find out our Tableau Training Course in Top Cities

IndiaUnited StatesOther Popular Cities
Tableau Training in BangaloreTableau Course in DallasTableau Course in Washington
Tableau Training in HyderabadTableau Course in CharlotteTableau Course in Austin
Tableau Training in ChennaiTableau Course in NYCTableau Course in Seattle

How to Speed up Context Filters

To improve the performance of context filters, and hence, increase the efficiency of Tableau, you could follow these guidelines;

If your data set is heavily indexed, context filters may not provide the performance you’re looking for and may also, actually cause slower query performance.

Demo

This example is intended to take you through the procedure of building a context filter.

 

  • When you click on the OK button, you shall see that the view is filtered to show the top 10 product Sub-Categories in terms of sales before you.

 

  • Moving on, let’s try and add another filter to show only furniture products. Now drag the Category field to the Filters shelf and select the only Furniture. When done, click on the OK button. The view is filtered but instead of 10 products, it now shows only  3. This is due to the fact that by default all filters in tableau are evaluated separately and the view is designed to show the intersection of the results. So on the screen, you’ll see that three of the top 10 overall products are furniture products.

.

 

  • Next, to determine the top 10 furniture products are we need to make the Category filter a context filter. Right-click on the field of the Filters shelf and select the Add to Context option.

 

  • The filter is marked as a context filter. The view updates to show the top four furniture products.

If you wish to master Tableau, Edureka has a curated Tableau Course that covers various concepts of data visualization in-depth, including conditional formatting, scripting, linking charts, dashboard integration, Tableau integration with R, and more. It comes with 24*7 support to guide you throughout your learning period. New batches are starting soon.

Got a question for us? Please mention it in the comments section of “Context Filters in Tableau” and we will get back to you at the earliest.

Upcoming Batches For Tableau Certification Training Course
Course NameDateDetails
Tableau Certification Training Course

Class Starts on 23rd November,2024

23rd November

SAT&SUN (Weekend Batch)
View Details
Tableau Certification Training Course

Class Starts on 21st December,2024

21st December

SAT&SUN (Weekend Batch)
View Details
BROWSE COURSES