What is a Context Filter in Tableau?

Cody Schneider8 min read

One of the most common frustrations in Tableau occurs when you try to create a "Top 10" list. You set up a filter to show the top 10 best-selling products, but when you add another filter for a specific category, the view suddenly shows fewer than 10 products - or maybe none at all. This isn't a bug, it's a matter of understanding how Tableau processes your instructions. This article will walk you through what a context filter is and how it solves this exact problem by changing the order in which Tableau filters your data.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

First, What Are Standard Filters in Tableau?

Before diving into context filters, let’s quickly refresh how standard filters work. In Tableau, a filter is any condition you apply to your dataset to limit the data shown in your visualization. The most common types are:

  • Dimension Filters: These are filters applied to qualitative or categorical data. For example, filtering your view to only show data for the "West" region or for the "Technology" product category. This is often done by dragging a blue pill to the Filters shelf.
  • Measure Filters: These are filters applied to quantitative or numerical data. You might use a measure filter to only show sales figures greater than $1,000 or to view orders with a profit margin between 10% and 20%. This is done with green pills.

When you add multiple dimension filters to a view - say, one for Region and one for Category - they are processed independently at the same time. Tableau looks at all the data that meets the Region criteria and all the data that meets the Category criteria simultaneously. This works perfectly for most scenarios, but it falls apart when one filter needs to depend on the results of another.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Tableau's Order of Operations: The Key to Understanding Context Filters

To understand why this happens, you need to know about Tableau's order of operations. Think of it as a specific sequence of steps Tableau follows every single time it builds a visualization. You don't directly see this process, but it dictates how filters, calculations, and other elements interact.

A simplified version of this pipeline looks like this:

  1. Extract Filters: Filters applied when creating a data extract from a live connection.
  2. Data Source Filters: Filters applied at the data source level itself, restricting what data enters the workbook.
  3. Context Filters: These filters are processed next. They create a temporary, smaller dataset that all subsequent filters will use.
  4. Dimension Filters: Filters on Set, Conditional, and "Top N" filters are processed here.
  5. Measure Filters: Numerical filters applied to your measures.
  6. Table Calculation Filters: The last filters to be applied, which hide data from view without actually filtering it out of the underlying calculation.

The "a-ha!" moment comes when you notice where Context Filters and Dimension Filters (including Top N) sit in this hierarchy. Context filters are applied before Top N and other standard dimension filters.

This is precisely why a standard dimension filter "breaks" your Top N view. Tableau calculates the Top 10 products across your entire dataset first, and then it applies your dimension filter (e.g., Category = 'Technology'). If some of your top 10 products weren't in the Technology category, they simply get removed from the view, leaving you with fewer than 10 results.

What is a Context Filter and How Does It Solve the Problem?

A context filter is an enhanced type of dimension filter. When you designate a dimension filter as a "context filter," you are telling Tableau to elevate its priority. You're forcing it to be processed before any other dimension, measure, conditional, or Top N filters on your worksheet.

Think of it this way:

  • A standard filter acts as a part of a filtering committee where everyone evaluates the data at the same time.
  • A context filter acts as a gatekeeper. It creates a temporary, filtered subset of your data first. Then, all the other filters in the "committee" are only allowed to work with the data that the gatekeeper let through.

When you turn your Category filter into a context filter, the sequence of events changes:

  1. Tableau first filters your entire dataset down to only include data where Category = 'Technology'.
  2. Next, working only with this smaller, pre-filtered subset, Tableau applies the "Top 10" filter to find the 10 best-selling products within the Technology category.

The result? You see exactly what you expect: a complete list of the top 10 products for the Technology category.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

How to Create a Context Filter in Tableau

Making a filter a context filter is incredibly simple. Just follow these steps:

  1. Drag the dimension you want to use as your primary, independent filter onto the Filters shelf. For our example, this would be the ‘Category’ pill.
  2. A dialog box will appear. Select the members you want to filter by (e.g., check the box for ‘Technology’) and click OK.
  3. On the Filters shelf, you will now see your dimension pill. Right-click on this pill.
  4. From the pop-up menu, select Add to Context.

That's it! You'll know it worked because the pill on the Filters shelf will turn from its standard blue color to a grayish hue. Any other filters you add now (like a Top N filter on product sales) will run on the dataset that has already been filtered by your gray context filter.

To remove the context, simply right-click the gray pill again and select Remove from Context.

When Should You Use a Context Filter? A Few Key Scenarios

1. Creating a Dependent Top N or Bottom N Filter

This is the classic use case we've been discussing. Whenever you want to find the top or bottom performers within a specific category or segment, the filter for that segment must be a context filter. Some examples include:

  • Show the top 5 states by sales, but only within the "East" supervisorial region. The region filter must be "in context."
  • Show the bottom 10 performing ad campaigns, but only for the month of July. The month filter must be "in context."
  • Find the 20 most recently hired employees within the "Engineering" department. The department filter must be "in context."

2. Improving Dashboard Performance in Large Datasets

Context filters can also be a valuable performance optimization tool. Because a context filter generates a temporary table, it can significantly speed up your dashboards if configured correctly.

Imagine your data source has tens of millions of rows covering 10 years of sales data. If a user only ever needs to look at data for the current year, you can add 'Year' as a context filter. When the dashboard loads or a user makes a selection, Tableau first creates a much smaller temporary dataset containing only the current year's data. All subsequent filters on the dashboard (for region, product, customer, etc.) will then query this smaller, faster temporary table instead of the massive original data source.

This dramatically reduces calculation time and makes a dashboard feel much more responsive. A good rule of thumb is to apply context filters to dimensions that significantly reduce the size of the dataset (by 80-90% or more) and are not changed frequently by the end-user.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Best Practices and Performance Considerations

While powerful, context filters should be used deliberately. Here are a few tips to keep in mind:

  • Don't Overuse Them: Every time a context filter is changed, Tableau has to do the heavy lifting of recomputing the temporary table. If you apply context filters to dimensions that users will change constantly, you can actually slow down your dashboard. Reserve them for higher-level, more static-style filters.
  • Use Low-Cardinality Fields: It’s best to use fields with fewer unique values as context filters. For instance, 'Continent' (7 values) or 'Shipping Method' (a handful of values) are great candidates. A field like 'Customer ID' (potentially thousands or millions of values) would be a poor choice and could harm performance.
  • Consider Other Options First: If your primary goal is just to improve performance by reducing the overall dataset size, first consider using an Extract Filter or a Data Source Filter. These are applied even earlier in the order of operations and are generally more efficient for permanently reducing the data pulled into your workbook.

Final Thoughts

Mastering context filters is a turning point for many Tableau users. It shifts your understanding from simply telling Tableau what to show to strategically guiding how it processes your requests. By controlling the order of operations, you can solve common analytical problems like Top N lists and significantly improve the performance and user experience of your dashboards.

Of course, while deep-diving into tools like Tableau is rewarding, sometimes you just need a quick, clear answer without having to configure filters or hierarchies. At Graphed, we remove these setup steps entirely. By securely connecting your data sources, you can ask for in-depth analysis like, "What were my top 10 products by revenue in Germany last month?" in plain English. We instantly build the dashboard for you, putting the focus entirely on the insight itself, instead of the process to get there.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!