Day 7 — Level of Detail - the FIXED expression
The feature that separates people who use Tableau from people who know Tableau.
The problem LODs solve
Every number in a Tableau view is computed at the level of detail of that view. Break the view down by Region and every measure is per region. Usually that is exactly right - until you need a number from a different level in the same view.
"What share of total sales is this region?" needs two levels at once: this region’s sales, and everything’s sales.
Every calculation on this page runs against the Orders data source below - 48 rows, dimensions in blue, measures in green, exactly as Tableau colours them.
FIXED ignores the view
Read it as: whatever the view is doing, group by this and compute that.
{FIXED : SUM([Sales])} with no dimension after FIXED means "the whole data source". It returns 30,37,800 on every row, whatever the view is broken down by. Divide one by the other and the shares add to 1.FIXED with a dimension
The two match on every row, because the view is already grouped by Region. The Grand Total matches as well - SUM around an LOD adds up the four region values, not the 48 row values.
They part company the moment the view sits at a different level. The same expression, broken down by Category instead:
Why FIXED is different from a plain aggregate
The middle column refuses to change as the view changes. That is the whole point - it is computed against the data source, not against the rows the view happens to be showing.
A FIXED that spans several groups
That fails, and the message explains why: with no Region in the view, the expression produces four different numbers and Tableau does not know which one you meant. Wrapping it in an aggregate resolves it:
MAX({FIXED [Region] : SUM([Sales])}) means "work out sales per region, then take the largest". Without the LOD there is no way to ask for the maximum of a group total, because MAX([Sales]) would give the largest single order instead.Comparing each region to the best
North leads, so its gap is zero and every other region shows how far behind it sits.
The three LOD keywords
| Keyword | What it does |
|---|---|
| FIXED | Ignores the view completely, uses only its own dimensions |
| INCLUDE | The view’s dimensions plus the ones you name |
| EXCLUDE | The view’s dimensions minus the ones you name |
Try these yourself
- Write a percent-of-total calculation broken down by Category.
- Find the sales of the largest single Category using an LOD.
- Work out each region gap to the best-performing region.
- Explain why {FIXED : SUM([Sales])} returns the same number on every row.
- Explain the difference between MAX([Sales]) and MAX({FIXED [Region] : SUM([Sales])}).
