Data Visualization with Tableau (39 Blogs) Become a Certified Professional
AWS Global Infrastructure

BI and Visualization

Topics Covered
  • Pentaho BI (8 Blogs)
  • Microsoft BI (7 Blogs)
  • Data Visualization with Tableau (37 Blogs)
  • BI and Data Visualization with Qlikview (1 Blogs)

How to Implement Context Filters in Tableau

Last updated on Nov 29,2022 2.4K Views

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;

  • Better Performance: If there are a lot of filters set or the data source is rather large, the queries tend to be slower. In such a scenario, one can set context filters to improve performance.

  • Top N Filter: One also can set a context filter to include only their data of interest, followed by setting a numerical or a top N filter.

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;

  • Select Add to Context option from the Context menu of an existing categorical filter. The context is then computed to generate the view. All your other filters will be then computed relative to the context.
  • Context filters:
  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;

  • Removing the field from the Filters shelf (A new context is computed if other context filters remain on the shelf)

  • Editing the filter (A new context is computed each time you edit a context filter)

  • Selecting Remove from Context (The filter remains on the shelf as a standard filter. A new context is computed if other context filters remain on the shelf)

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;

  • Deploying a single context filter that significantly reduces the size of the data set is a way better idea than applying many filters. As a matter of fact, if a filter does not reduce the size of the data set by one-tenth or more, it is actually worse to add it to the context. It costs the performance of computing the context.

  • It’s reckoned to finish all of your data modelings before creating a context. Alterations in the data model, such as converting dimensions to measures, require recomputing of the context.

  • Set the required filters for the context. Also, create the context before adding fields to other shelves. These prerequisites make the queries that are run much faster when you drop fields on other shelves.

  • Using date bins like YEAR(date) or context filters on discrete dates is more effective than using continuous dates.

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.


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

  • First, you’ll filter a view to show the top 10 products by sales. Next, create a context filter on the Product Category so you can see the top 10 furniture products.

  • Use the Sample – Superstore data source to create the initial view. The view shows the sales for all Sub-Categories, sorted in descending order.


  • Now build a Top 10 filter to only show the top-selling products. You can do so by dragging the Sub-Category field to the Filters shelf. In the dialog box that appears, switch to the Top tab and define a filter that is Top 10 by Sum of Sales.



  • 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.

sub category


  • 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 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 NameDate
Tableau Certification Training Course

Class Starts on 23rd September,2023

23rd September

SAT&SUN (Weekend Batch)
View Details

Join the discussion

Browse Categories
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

How to Implement Context Filters in Tableau