LOD Expressions
& Filters
Master how Level of Detail expressions interact with Tableau's filter pipeline, and learn to use context filters to control exactly what data your LOD calculations see.
What Is an LOD Expression?
A Level of Detail (LOD) expression lets you compute an aggregation at a different granularity than the current visualization. Instead of being bound to whatever dimensions are on your Rows and Columns shelves, an LOD tells Tableau: "Compute this measure at this specific level."
Three Types of LOD Expressions
Why Filters Complicate LOD
Tableau processes operations in a strict order of operations (a pipeline). Filters at different stages see different slices of data. The critical question is: does my LOD calculate before or after my filter?
If your LOD runs before a dimension filter, the LOD sees all the data, including rows the filter later removes. This creates results that look wrong: a "total per customer" that includes customers you filtered out.
Tableau's Order of Operations
FIXED vs INCLUDE / EXCLUDE with Filters
| FIXED | INCLUDE / EXCLUDE | |
|---|---|---|
| Dimension filters | Ignored | Respected |
| Context filters | Respected | Respected |
| Extract filters | Respected | Respected |
| Data source filters | Respected | Respected |
| Table calc filters | Ignored | Ignored |
What Is a Context Filter?
A context filter tells Tableau: "Apply this filter first, before computing any FIXED LOD expressions." It moves the filter from step 5 (dimension filters) up to step 3 in the order of operations.
Step-by-Step: LOD + Filter Workflow
Example 1: Customer Total in a Region Filter
Goal: Show each customer's total sales, but only for customers in the West region.
{ FIXED [Customer ID] : SUM([Sales]) }
Example 2: Before vs After Context Filter
Example 3: Multiple Context Filters
Scenario: You want the average order value per product category, but only for 2023 orders in the Technology segment.
INCLUDE and EXCLUDE with Filters
Unlike FIXED, the INCLUDE and EXCLUDE expressions naturally respect dimension filters. They execute at step 6 in the pipeline: after both context filters and dimension filters have already been applied.
{INCLUDE [Order ID] : SUM(Sales)}Adds Order ID to the calculation level. A Region filter will restrict which orders are included.
{EXCLUDE [Region] : AVG(Sales)}Removes Region from the calculation level. A Category filter will still restrict the data.
Context Filters and Performance
Context filters create a temporary table in memory. Every time the context filter changes, Tableau re-creates this table. This has real performance implications.
Common Mistakes
Summary: LOD + Filter Interactions
| Scenario | LOD Type | Need Context? |
|---|---|---|
| Customer total, filtered by region | FIXED | Yes |
| Order-level detail, filtered by category | INCLUDE | No |
| Remove a dimension, filtered by date | EXCLUDE | No |
| Top N customers in one segment | FIXED | Yes |
| Percent of total within filtered data | FIXED | Yes |
Question 1 of 5
You have a FIXED LOD that calculates total sales per customer. You add a Region = "East" dimension filter. What happens?
Question 2 of 5
How do you make a FIXED LOD respect a dimension filter?
Question 3 of 5
Which LOD types already respect dimension filters without needing a context filter?
Question 4 of 5
A context filter is set on Segment = "Consumer". A FIXED LOD calculates {FIXED [Category] : SUM(Sales)}. What data does the LOD use?
Question 5 of 5
Why might you avoid making every filter a context filter?