Why Your Tableau Filter Did Not Do What You Expected: The Order of Operations
You put a Top 10 Customers filter on the view and a Region filter beside it. Choose North and eight rows appear. Nothing is broken: Tableau computed the top 10 before it applied the region filter, then threw two of them away.
What you do: learn the sequence, then use context filters to move a filter earlier when the order is wrong for your question.
The short version. Filters do not all run at the same time, and the earlier ones decide what the later ones can see.
The sequence
| Order | Stage | What lives here |
|---|---|---|
| 1 | Extract filters | Rows never brought into the extract at all |
| 2 | Data source filters | Applied to every sheet in the workbook |
| 3 | Context filters | Dimension filters you promoted |
| 4 | FIXED level of detail | Computed on what stages 1 to 3 left |
| 5 | Dimension filters | The ordinary filter shelf, and top N |
| 6 | INCLUDE and EXCLUDE level of detail | After dimension filters |
| 7 | Measure filters | Filters on aggregates, such as SUM(Sales) > 1000 |
| 8 | Table calculation filters | Hide marks without changing the calculation |
| 9 | Totals, reference lines, forecasts | Drawn on what survived |
Two rows of this table explain most confusion. Stage 4 is why a FIXED expression seems to ignore the filter you just set: it does ignore it, unless that filter is in context. And stage 8 is why a table calculation filter hides rows while leaving a running total looking like it still counts them, which is usually exactly what you want.
The context filter, worked
Back to the Top 10 problem. Region is a dimension filter at stage 5, and so is the Top 10, so they compete inside the same stage with the top N computed against everything the earlier stages allowed through.
Right click the Region filter and choose Add to Context. It turns blue and moves to stage 3. Now the top 10 is computed within North only, and ten rows appear.
The cost: a context filter creates a temporary table behind the scenes, so it is not free. Use it where it is needed rather than as a habit, and remember that changing a context filter forces more work than changing an ordinary one.
Where a filter can be applied
| Scope | How to set it | Use for |
|---|---|---|
| This sheet only | Drag to the Filters shelf | Most things |
| Selected sheets | Apply to Worksheets, Selected | A dashboard where two views share a control |
| All using this source | Apply to All Using This Data Source | A workbook-wide slice, such as one year |
| Data source | Data menu, Edit Data Source Filters | Excluding test rows permanently |
| Extract | On the extract dialog | Keeping the extract small |
Rows that should never appear in any view belong in the extract or data source filter, not on a shelf. It is the same argument as filtering in Power Query rather than in a report: a filter one click away from being removed will eventually be removed.
The three symptoms and their causes
- Top N returns fewer rows than N. A dimension filter is competing with it. Add that filter to context.
- A percent of total does not change when you filter. The denominator is a
FIXEDexpression running before the filter. Add the filter to context, or useINCLUDE, or write the total as a table calculation. - Hiding a row changes the running total. You used a dimension filter where you wanted a table calculation filter. Filtering with a table calc, or right click and Hide, keeps the calculation intact.
Hide is not filter
Right clicking a header and choosing Hide removes the mark from the view without removing the row from the calculation. That is genuinely useful for a running total or a percent of total, and it is a trap when you meant to exclude the data. Hidden members do not appear in the filter shelf, so nothing on screen says they exist, and a colleague opening the workbook will not find them.
How to apply this to your own work
- Open your most complicated sheet and read the filter shelf colours. Note which are in context.
- For every top N filter, check whether another dimension filter should be in context beside it.
- Search your calculated fields for
FIXEDand ask which filters it is meant to respect. - Move permanent exclusions into a data source filter and remove them from the shelves.
- Check for hidden members before you trust any total, using Analysis, Reveal Hidden Data.
The one habit to keep
When a view surprises you, ask which stage each part of it runs in. That question converts a mysterious result into a sequence you can reason about, and it works for every version of Tableau.
Is the top N on your dashboard computed before or after the region filter?
Tableau for Analysts is 110 pages on how Tableau actually thinks: dimensions against measures, relationships against joins, sets, and level of detail. Enough that you stop dragging fields until it looks right.
Tableau for Analysts, $19 →Table calculations sit at the far end of the sequence, and sorting in Tableau is affected by the same order. The Tableau Kit has the drills.
Read Table Calculations →