Context Filters
in Tableau
Learn how context filters change the order of operations in Tableau, why they matter for accurate analysis, and when to use them.
What Is a Filter in Tableau?
A filter restricts the data shown in a visualization. When you drag a dimension or measure to the Filters shelf, Tableau removes rows that don't match your criteria before rendering the view.
Tableau's Order of Operations
Tableau processes filters in a fixed pipeline. Each stage narrows the data before the next stage runs. Understanding this sequence is the key to mastering context filters.
What Is a Context Filter?
A context filter is a regular dimension filter that you promote to run earlier in the pipeline. It creates a temporary table of results, and all other filters then operate on that smaller dataset instead of the full data source.
Why Does Order Matter?
When two regular filters run independently, each one evaluates against the entire data source. This means a "Top N" filter calculates the top N across all data, not just the subset you care about. Context filters solve this by narrowing the data first.
The Core Rule
Without vs With Context Filter
Regular vs Context Filters
| Regular Filter | Context Filter | |
|---|---|---|
| Execution Order | All run simultaneously | Runs before other filters |
| Creates Temp Table | No | Yes |
| Affects Top N | Top N on full data | Top N on subset |
| Performance | Faster for small data | Overhead for temp table |
| Visual Cue | Normal pill color | Grey pill on shelf |
When to Use Context Filters
How to Apply a Context Filter
Example 1: Top 3 Products in Furniture
Goal: Show the 3 best-selling products within the Furniture category only.
Example 2: Dependent Filters for Regions
Goal: Show only customers in the West region whose total sales exceed \( \$5,000 \). You need the region filter to run first so the sales calculation only considers West data.
Example 3: Performance Optimization
Scenario: Your data source has 50 million rows. You only care about the current year. Adding Year as a context filter creates a temporary table of ~10 million rows, making all subsequent filters and calculations much faster.
Context Filters and Sets
Context filters also influence fixed sets and conditional sets. A set defined as "Top 10 by Profit" will compute those Top 10 within the context, not across the entire data source.
Common Mistakes
Summary Comparison
| Regular Filter | Context Filter | |
|---|---|---|
| Pipeline Position | Stage 4 (Dimension) | Stage 3 (Before Dimension) |
| Temp Table | No | Yes |
| Top N Scope | Full data | Context subset |
| Set Membership | Full data | Context subset |
| Best For | Simple filtering | Dependent, scoped analysis |
| Pill Color | Blue/Green | Grey |
Question 1 of 5
What does a context filter create when applied in Tableau?
Question 2 of 5
You want the Top 5 products by sales within the Office Supplies category. Which approach gives the correct result?
Question 3 of 5
In Tableau's order of operations, context filters execute at which stage?
Question 4 of 5
Which of the following is a disadvantage of using context filters?
Question 5 of 5
How can you visually identify a context filter on the Filters shelf in Tableau?