Historical Context & Motivation
The tension between filtering data and computing aggregates is not unique to Tableau—it has deep roots in the relational database world. When Edgar F. Codd formalized the relational model in 1970, he introduced operations like selection (σ) and projection (π) that operate on individual rows, alongside aggregate functions that collapse entire sets of rows into scalar values. SQL later codified this distinction through the WHERE clause (which filters rows before aggregation) and the HAVING clause (which filters after aggregation). This duality is the conceptual ancestor of Tableau's own multi-layered filter architecture.
The core question this lesson addresses is deceptively simple: when you apply a filter in Tableau, does it shrink the dataset before the aggregation runs, or does it act on already-aggregated marks? The answer depends entirely on the type of filter and its position in Tableau's order of operations. Misunderstanding this interaction is one of the most common sources of incorrect dashboards, and mastering it is essential for any data professional.
Core Principles & Definitions
To reason about how filters and aggregation interact, you need a clear mental model of Tableau's internal query pipeline. At its heart, Tableau translates every view you build into a SQL-like query against the data source. The order of operations determines the sequence in which extract filters, data source filters, context filters, sets and conditional filters, dimension filters, measure (aggregate) filters, table calculation filters, and trend-line or reference-line filters are evaluated. Each layer either reduces the row-level data before aggregation or acts on aggregated results after they are computed. This ordering is not merely a performance consideration—it changes the semantic meaning of your visualization.
Pre-Aggregation Filters
Post-Aggregation Filters
Context Filters
LOD Expressions & Filters
Aggregation Granularity
Visual Explanation — The Tableau Order of Operations
Notice the critical aggregation boundary drawn as a dashed amber line in the diagram. Everything above that line modifies the raw rows fed into functions like SUM(Sales) or AVG(Profit). Everything below it operates on the already-computed aggregated values. This distinction is the single most important concept in this lesson. When you drag a dimension to the Filters shelf, you are removing rows; when you drag a measure to the Filters shelf and set a condition (e.g., SUM(Sales) > 10000), you are hiding marks that do not meet the threshold after the summation has already been calculated.
How It Works — The Query Execution Model
When you build a view in Tableau, VizQL (Tableau's visual query language) translates your shelf configuration into a SQL-like query. Understanding the generated query structure reveals exactly where filters and aggregations interact. Consider a view that shows SUM(Sales) by Category with a dimension filter excluding "Furniture" and a measure filter requiring SUM(Sales) > 50000. Conceptually, VizQL generates a query analogous to the following structure.
Context Filters as Subquery Materialization
When you promote a dimension filter to a context filter, Tableau conceptually materializes a temporary table containing only the rows that pass that filter. All subsequent filters and computations—including FIXED LOD expressions, Top N filters, and conditional filters—operate against this reduced dataset rather than the full data source. This is analogous to a WITH (CTE) or subquery in SQL that pre-filters before the main query runs. The practical consequence is that a Top 10 filter, which is computed based on aggregated results, will compute its ranking within the context-filtered subset rather than across all data.
LOD Expressions and the Filter Interaction
Level of Detail (LOD) expressions add another layer of complexity. A {FIXED [Customer] : SUM(Sales)} expression computes the sum at the customer level regardless of what dimensions are in the view. Crucially, FIXED LOD expressions are computed after context filters but before dimension filters. This means that a dimension filter on Category will not affect the FIXED calculation, but a context filter on Category will. In contrast, INCLUDE and EXCLUDE LODs are computed after dimension filters, meaning they respect the standard filter shelf. This ordering is not configurable—it is hardwired into Tableau's execution model.
Detailed Breakdown — Filter Types and Their Aggregation Impact
Each filter type in Tableau occupies a specific position in the order of operations. The following table classifies every major filter type, its execution phase relative to aggregation, and its concrete effect on computed values. This is the reference you should internalize to predict how any filter will behave in a real dashboard.
| Filter Type | Phase | Acts On | Effect on Aggregation |
|---|---|---|---|
| Extract Filter | Pre-aggregation (earliest) | Raw rows at extract creation | Rows permanently excluded from .hyper file; all aggregations affected |
| Data Source Filter | Pre-aggregation | Rows at connection level | Rows excluded before any sheet; aggregations on all sheets affected |
| Context Filter | Pre-aggregation (materialized) | Rows → temp table | Creates subset; Top N and FIXED LODs computed within this subset |
| Dimension Filter | Pre-aggregation | Rows matching dimension members | Removes rows → changes SUM, AVG, COUNT, etc. |
| Measure Filter | Post-aggregation | Aggregated marks | Hides marks; aggregation values unchanged; percentages may shift |
| Table Calc Filter | Post-aggregation (latest) | Computed table calc values | Hides marks; table calc still computed on full partition; running totals unaffected |
Worked Example — Predicting Filter-Aggregation Outcomes
Let us walk through a concrete scenario using Tableau's Superstore sample dataset. The goal is to build a bar chart of AVG(Profit) by Sub-Category, then apply multiple filters and predict their combined effect on the displayed values.
Sub-Category to Rows and Profit (aggregated as AVG) to Columns. Tableau computes AVG(Profit) across all rows for each sub-category. For example, suppose "Tables" has 319 rows with a total profit of −$17,725, yielding AVG(Profit) = −$17,725 / 319 ≈ −$55.57.Region to the Filters shelf and exclude "South." This is a standard dimension filter, so it operates pre-aggregation. All rows where Region = 'South' are removed before AVG is computed. Suppose the South contributed 65 rows for Tables with a disproportionately negative average. Removing those rows changes both the numerator (total profit) and denominator (row count) of the AVG function. The new computation might be AVG(Profit) = −$12,100 / 254 ≈ −$47.64.AVG(Profit) to the Filters shelf and set the condition: AVG(Profit) > 0 (show only profitable sub-categories). This is a measure filter—it runs after aggregation. Tableau first computes AVG(Profit) for every sub-category using the already-filtered rows (South excluded). Then it hides any sub-category whose AVG(Profit) ≤ 0. Tables (−$47.64) would be hidden. Importantly, the displayed sub-categories retain their exact aggregated values; no recomputation occurs.Strengths, Limitations & Common Mistakes
Knowing the conceptual distinction between pre- and post-aggregation filters is necessary, but you also need to understand the practical trade-offs of each approach. The table below summarizes when each filter type is advantageous, when it introduces risk, and the performance considerations that matter at scale.
| Consideration | Pre-Aggregation Filters | Post-Aggregation Filters |
|---|---|---|
| Aggregation impact | Changes computed values (SUM, AVG, COUNT, etc.) | Values remain unchanged; marks are only hidden |
| Grand totals | Grand total recalculated on reduced dataset | Grand total may include hidden marks (depends on settings) |
| Percent-of-total | Denominator shrinks; remaining categories sum to 100% | Denominator unchanged; visible slices may not sum to 100% |
| Performance | Reduces data processed → faster queries at scale | Full dataset still aggregated → no query-side savings |
| LOD interaction | Context filters affect FIXED LODs; dimension filters do not | No effect on LOD computation |
| Best use case | Scoping analysis to a meaningful subset (e.g., single region, date range) | Hiding outliers or low-volume marks without distorting aggregations |
Connection to Advanced Theory — LOD Expressions and Tableau Prep
The filter-aggregation interaction you have learned in this lesson is the foundation for more advanced Tableau features. As you progress, you will encounter scenarios where the default order of operations is insufficient and you need explicit control over when computations happen. LOD expressions (FIXED, INCLUDE, EXCLUDE) are the primary mechanism for overriding the default granularity of aggregation, and their behavior is tightly coupled to the filter pipeline. Similarly, Tableau Prep allows you to apply filters and aggregations at the data-preparation stage, effectively pushing these operations before Tableau Desktop's pipeline even begins.
| Concept | This Lesson (Basics) | Advanced Extension |
|---|---|---|
| Dimension filter | Removes rows before SUM/AVG; applied via Filters shelf | FIXED LODs ignore dimension filters; use context filters to scope FIXED LODs |
| Measure filter | Hides marks post-aggregation; does not change values | Table calculations can reference hidden marks; WINDOW_SUM includes filtered-out values |
| Context filter | Materializes subset; scopes Top N filters | Scopes FIXED LODs; multiple context filters stack as AND conditions on materialized set |
| Order of operations | Linear pipeline: extract → data source → context → dimension → agg → measure → table calc | LOD expressions insert additional aggregation passes at specific points; sets and parameters add further branching |
As a forward-looking note, many Tableau performance-tuning strategies revolve around pushing filters earlier in the pipeline. Extract filters are the most performant because they physically reduce the data volume. Data source filters avoid transmitting unnecessary rows. Context filters reduce the working set for complex downstream calculations. Understanding the filter-aggregation interaction is therefore not just an analytical correctness concern—it is also a computational complexity concern that directly impacts dashboard responsiveness, especially when working with millions of rows or real-time connections.
Practice Problems
SUM(Sales) by Category. You add Region to the Filters shelf and exclude "West." Is this a pre-aggregation or post-aggregation filter? How does it affect the displayed SUM(Sales) values?SUM(Sales) > 50,000. Which categories are visible, and what SUM(Sales) values do they display? Does the grand total include Category C's $30,000?AVG(Profit) by Sub-Category and you want to show only the Top 5 sub-categories by AVG(Profit), but only within the "East" region. You set Region = 'East' as a regular dimension filter and Sub-Category as a Top 5 filter. Will the Top 5 be computed within the East region only, or across all regions? What would you change to ensure the Top 5 is scoped to the East?SUM(Sales) by Product Name with a quick filter for Segment (Consumer, Corporate, Home Office). They also use a FIXED LOD expression: {FIXED [Product Name] : SUM(Sales)} as a reference line. When the user selects Segment = 'Consumer', they notice the reference line values do not change, but the bar heights do. Explain why and propose a fix.Lesson Summary
The interaction between filters and aggregation in Tableau is governed by a strict order of operations. Pre-aggregation filters—including extract filters, data source filters, context filters, and dimension filters—remove rows from the dataset before aggregation functions like SUM, AVG, and COUNT are computed, thereby altering the values produced. Post-aggregation filters—measure filters and table calculation filters—hide marks whose aggregated values fail a condition, without changing the underlying computation.
The critical nuance lies in context filters, which materialize a subset of data and scope downstream operations including FIXED LOD expressions and Top N filters. FIXED LODs are computed after context filters but before dimension filters, while INCLUDE and EXCLUDE LODs respect dimension filters. Choosing the wrong filter type leads to incorrect aggregations, misleading grand totals, and dashboards that silently misrepresent the data. Always identify where in the pipeline your filter executes before trusting the numbers.