Tableau Advanced Filters and Context
Standard filters work well for most tasks. Advanced filtering techniques give you finer control — filtering at different stages of the pipeline, filtering across data sources, and using one filter to set the environment for others. This topic covers Context Filters, Data Source Filters, and condition-based Dimension filters.
Recap: The Filter Order
Tableau runs filters in a specific sequence. Changing where a filter runs changes what it affects. The order from first to last:
1. Extract Filters → Limit data when extract is created 2. Data Source Filters → Apply before data reaches any sheet 3. Context Filters → Create an independent data environment 4. Dimension Filters → Filter by category values 5. Measure Filters → Filter by aggregated numbers 6. Table Calc Filters → Filter after table calculations run
Context Filters
A context filter creates a temporary data environment. Tableau processes the context filter first, then runs all other filters within that context. This matters for two specific situations: making a Top N filter respect another filter, and improving performance on large datasets.
The Top N Without Context — Common Mistake
Scenario: Show Top 5 products in the East region
Step 1: Add Region = East filter to Filters shelf
Step 2: Create a Top 5 Products set and add to Filters shelf
Problem: Tableau calculates Top 5 from ALL regions first,
then applies the Region = East filter.
Result: The Top 5 might include products that
are not top sellers in East specifically.
Fix: Promote Region Filter to Context
Right-click the Region filter on the Filters shelf → Select "Add to Context" → Region = East is now a context filter (gray chip on shelf) Now Tableau: 1. First isolates East region data 2. THEN calculates Top 5 within East Result: Top 5 products are the actual top sellers in East only
Diagram: Context Filter Effect
Without Context: With Context:
All Regions → Top 5 East Region First →
↓ ↓
Top 5 from all Top 5 from East only
(may miss East specifics) (accurate East leaders)
Adding a Context Filter
Right-click any filter on the Filters shelf and select "Add to Context." The filter chip turns gray to indicate context status. Add multiple filters to context if needed — they all run first, creating the defined data environment for all remaining filters.
Data Source Filters
Data Source Filters apply before any sheet sees the data. Every worksheet in the entire workbook works with only the filtered data. Use data source filters when you want to permanently limit a large dataset — for example, remove test orders, internal employee records, or data from inactive markets.
Adding a Data Source Filter
- Go to the Data Source tab (bottom of screen)
- Click "Add" in the Filters section at top right of the Data Source page
- Choose a field and set filter conditions
- Click OK
All sheets in the workbook now work only with data that passes this filter. The filtered-out rows are invisible to every chart, calculation, and LOD expression in the workbook.
Condition Filters
Standard Dimension filters let you check or uncheck specific values. Condition filters apply a formula to determine which Dimension members to keep. Right-click a field on the Filters shelf → Edit Filter → Condition tab.
Condition Filter Examples
| Goal | Condition Filter |
|---|---|
| Show only products with positive profit | SUM([Profit]) > 0 |
| Show customers with more than 5 orders | COUNT([Order ID]) > 5 |
| Show regions with above-average sales | SUM([Sales]) > AVG(SUM([Sales])) |
| Show products discounted more than 20% | AVG([Discount]) > 0.20 |
Top / Bottom Filters
Click the "Top" tab in a Dimension filter dialog. Select "By field" and set Top or Bottom N items. Choose the Measure and aggregation. This filter dynamically recalculates as the data changes — unlike a fixed set, it always shows the current top N based on live data.
Dynamic Top 10 vs Fixed Set
Top Filter (dynamic): Next month, if a new product enters the top 10, it automatically appears. Old #10 disappears. Fixed Set (static): The same 10 products are always "In" regardless of performance changes next month. → Use Top Filter for live monitoring dashboards → Use Fixed Set for comparing a fixed baseline group
Wildcard Filters
String Dimensions support wildcard matching. In the filter dialog, click the "Wildcard" tab. Use * as a wildcard character. For example, filtering Product Name "starts with" Mac* shows all products starting with "Mac" — MacBook, MacBook Pro, MacBook Air, Mac Studio, etc. This works without manually checking each item.
Filter Across Data Sources
When your workbook connects to multiple data sources, filters apply only to the source they come from by default. To apply one filter across all data sources, right-click the filter on the Filters shelf and select "Apply to Worksheets" → "All Using This Data Source" or "Selected Worksheets." For cross-source filtering, use a shared Dimension (like Date or Region) that exists in both sources and matches values precisely.
Show/Hide Filter Controls Conditionally
Use a parameter-driven approach to show filter controls only when needed. Create a Boolean parameter "Show Filter." In a calculated field, reference this parameter to conditionally show or hide content. Advanced dashboards use this technique to keep the interface clean until the viewer opts into advanced filtering options.
Summary
Context Filters solve the Top N problem by creating a filtered data environment before other filters run. Promote any filter to context with a right-click. Data Source Filters apply globally across the entire workbook before any chart sees the data — use them to permanently exclude irrelevant records. Condition Filters use formula logic to dynamically include or exclude Dimension members based on aggregated Measure values. Top/Bottom filters always show the current leaders based on live data. Wildcard filters quickly match text patterns without manually checking every value.
