01 / 20

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.

Tableau

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."

{ FIXED [Customer ID] : SUM([Sales]) }

Three Types of LOD Expressions

FIXED
Computes at the exact dimensions you specify, ignoring the view's granularity.
INCLUDE
Adds dimensions to the view level, making the calculation more granular than the viz.
EXCLUDE
Removes dimensions from the view level, making the calculation less granular (coarser).

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

1. Extract Filters 2. Data Source Filters 3. Context Filters 4. FIXED LOD 5. Dimension Filters 6. INCLUDE / EXCLUDE Runs BEFORE FIXED LOD Promotes a dimension filter to step 3 in the pipeline FIXED sees all data that survived steps 1-3 Normal dimension filters Applied AFTER FIXED LOD: LOD already computed on full data

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.

Without Context
FIXED LOD sees all data. Dimension filter only hides rows in the viz after the LOD has already computed.
With Context
FIXED LOD sees only filtered data. The context filter physically restricts the dataset before LOD runs.

Step-by-Step: LOD + Filter Workflow

1
Write your LOD expression. Decide whether you need FIXED, INCLUDE, or EXCLUDE based on the granularity you need.
2
Identify your filters. List every filter on the Filters shelf and note which type each is (dimension, measure, date).
3
Check for conflicts. Ask: "Should my FIXED LOD respect this dimension filter?" If yes, proceed to step 4.
4
Promote to context. Right-click the filter, select "Add to Context." Repeat for each conflicting filter.
5
Validate results. Compare LOD values before and after adding context. Confirm the numbers match expectations.

Example 1: Customer Total in a Region Filter

Goal: Show each customer's total sales, but only for customers in the West region.

// LOD expression:
{ FIXED [Customer ID] : SUM([Sales]) }

Example 2: Before vs After Context Filter

Without Context Filter Customer Region Sales Alice West $200 Alice East $300 Bob West $150 FIXED result for Alice: $200 + $300 = $500 (Includes East even though filter = West) With Context Filter Customer Region Sales Alice West $200 Alice East $300 ✕ Bob West $150 FIXED result for Alice: $200 only (East row removed before LOD runs) LOD sees all regions LOD sees West only

Example 3: Multiple Context Filters

Scenario: You want the average order value per product category, but only for 2023 orders in the Technology segment.

{ FIXED [Category] : AVG([Order Value]) }
1
Add Year filter: Set Year = 2023, then right-click and choose "Add to Context."
2
Add Segment filter: Set Segment = Technology, then right-click and choose "Add to Context."
3
Result: The FIXED LOD now computes on only 2023 Technology orders, giving the correct average per category.

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 Example
{INCLUDE [Order ID] : SUM(Sales)}
Adds Order ID to the calculation level. A Region filter will restrict which orders are included.
EXCLUDE Example
{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.

✓ When to use
When a FIXED LOD must respect a dimension filter, or when you need Top N results filtered by another dimension.
✕ When to avoid
On rapidly changing filters (like quick filters users adjust frequently) against very large datasets.

Common Mistakes

✕ Forgetting Context
Using a FIXED LOD with a dimension filter and expecting the filter to apply. The LOD ignores it without "Add to Context."
✕ Over-Using Context
Making every filter a context filter "just in case." This forces Tableau to rebuild temporary tables constantly, hurting performance.
✕ Confusing LOD Types
Using INCLUDE when you need FIXED. INCLUDE is relative to the view: if you add or remove dimensions on shelves, the result changes.

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?