Understanding
LOD Expressions
Master Level of Detail expressions in Tableau: control exactly which dimensions participate in your calculations, independent of your view.
What is Level of Detail?
In Tableau, the level of detail (LOD) of your view is determined by the dimensions on Rows, Columns, and the Marks card. Every time you add or remove a dimension, you change the granularity of the data.
The Granularity Problem
Sometimes you need a calculation at a different granularity than the view shows. For example: you want to see each order, but also know each customer's total. Regular aggregations can't mix levels.
Why LOD Expressions Exist
The Three LOD Types
LOD Expression Syntax
{ FIXED | INCLUDE | EXCLUDE
[Dimension1], [Dimension2], ... :
AGG(measure) }
{ FIXED [Customer Name] : SUM([Sales]) }
Deep Dive: FIXED
Deep Dive: INCLUDE
Deep Dive: EXCLUDE
LOD vs Table Calculations
| LOD Expressions | Table Calculations | |
|---|---|---|
| Computed where? | Data source (query level) | Locally in Tableau (after query) |
| Granularity control | You specify dimensions | Depends on view layout |
| Filter interaction | Computed before dimension filters | Computed after all filters |
| Use case | Cross-level comparisons | Running totals, ranks, moving averages |
| Syntax | { FIXED [Dim] : AGG(Measure) } | WINDOW_SUM(), RUNNING_TOTAL() |
When to Use Each Type
How to Write an LOD Expression
Example 1: Customer Total
Goal: Show each order, but also display the customer's total sales across all orders.
{ FIXED [Customer Name] : SUM([Sales]) }
Example 2: Average Order Size
Goal: View shows regions. You want the average order size per customer, then average those across the region.
{ INCLUDE [Customer Name] : AVG([Sales]) }
Example 3: Percent of Total
Goal: View shows Region + Category. You want each category's sales as a percentage of its region's total.
{ EXCLUDE [Category] : SUM([Sales]) }
// Percent of region:
SUM([Sales]) / ATTR(
{ EXCLUDE [Category] : SUM([Sales]) }
)
Common Mistakes
Summary Comparison
| FIXED | INCLUDE | EXCLUDE | |
|---|---|---|---|
| Relation to view | Independent | Adds dimensions | Removes dimensions |
| Granularity | Exactly as specified | Finer than view | Coarser than view |
| Filter behavior | Before dim filters | After dim filters | After dim filters |
| Typical use | Cohorts, totals | Avg of sub-groups | Percent of parent |
| Example | { FIXED [Cust] : SUM } | { INCLUDE [Cust] : AVG } | { EXCLUDE [Cat] : SUM } |
Question 1 of 5
What does "level of detail" refer to in Tableau?
Question 2 of 5
Which LOD keyword computes at exactly the dimensions you specify, ignoring the view?
Question 3 of 5
Your view shows [Region] and [Category]. You write:
{ EXCLUDE [Category] : SUM([Sales]) }
At what level does this compute?
Question 4 of 5
A key difference between LOD expressions and table calculations is:
Question 5 of 5
You want to compute the average sales per customer while your view only shows [Region]. Which approach is correct?