BEGINNER SERIES
Level Of Detail,
explained.
#DataFam #KenyaTUG #Tableau
Your chart can only
answer one question at a time.
You build a chart grouped by Region.
Tableau totals everything by Region since that's all it knows.
Then your boss asks:
"What's the average spend per customer?"
That's a different question. At a different level.
Tableau can't answer it from a Region chart. Not without help.
LOD = Level of Detail
A way to tell Tableau: "Calculate this at a different level than what's on the chart." That's the whole idea.
Like a cashier who only
sees the daily total.
A cashier prints one receipt at the end of the day, the grand total.
You ask: "How much did customer Jane spend?"
The cashier says: "I only have the total."
An LOD expression is like giving that cashier a separate notebook that tracks each customer, even while the till still shows the daily total.
๐ Without LOD
Tableau only calculates at your chart level. You're stuck with the wrong number.
โ With LOD
You tell Tableau exactly which level to use โ separately from the chart.
USED IN EVERY EXAMPLE THAT FOLLOWS
6 orders ยท 4 customers ยท 2 regions
| Region | Customer | Order | Sales |
|---|---|---|---|
| East | Alice | #1 | 150 |
| East | Alice | #2 | 150 |
| East | Bob | #1 | 100 |
| West | Carol | #1 | 400 |
| West | Dan | #1 | 100 |
| West | Dan | #2 | 100 |
EAST TOTAL
400
Alice 300 ยท Bob 100
WEST TOTAL
600
Carol 400 ยท Dan 200
โ Alice has 2 orders, Bob has 1. This causes the wrong average โ as you'll see next.
Every LOD question
has two levels inside it.
One is your chart โ What Tableau is already showing.
One is the missing piece โ What you actually need.
Find both, then ask where the missing one sits.
INCLUDE
Missing level is more detailed than your chart
EXCLUDE
Missing level is less detailed than your chart
FIXED
Value must stay locked no matter what the chart shows
WHEN YOU NEED SOMETHING MORE DETAILED
"Average spend per customer,
shown by region"
Your chart is at Region level.
The missing piece is at Customer level which is more detailed. So you INCLUDE Customer.
most detailed
your chart
How to remember it
Customer is more detailed (finer) than Region. You're pulling in something your chart doesn't have. You're including a finer level.
Why the obvious answer is wrong.
| Region | Customer | Order | Sales |
|---|---|---|---|
| East | Alice | #1 | 150 |
| East | Alice | #2 | 150 |
| East | Bob | #1 | 100 |
| West | Carol | #1 | 400 |
| West | Dan | #1 | 100 |
| West | Dan | #2 | 100 |
โ Without LOD ยท AVG(Sales) by Region
East shows 133. That's (150+150+100)รท3 = avg of 3 orders. Not customers. Alice's extra order skews the result.
โ With INCLUDE ยท average of customers
Sums per customer: Alice=300, Bob=100. Then (300+100)รท2 = 200. East=200, West=300. Correct.
Read as: "For each Customer, sum their Sales. Then average those, by Region."
133 vs 200. One is a lie.
โ ORDERS AVERAGED
133
3 orders, wrong denominator
โ CUSTOMERS AVERAGED
200
2 customers, right denominator
The 67-point gap exists only because Alice has 2 orders.
INCLUDE forces Tableau to group by customer first, so the order count stops mattering.
AVG( { INCLUDE [Customer] : SUM([Sales]) } )WHEN YOU NEED SOMETHING LESS DETAILED
"Each customer's share
of their region's total"
Your chart is at Customer level.
To calculate a %, you need the Region total, which is broader.
So you EXCLUDE Customer from the denominator.
most detailed
your chart
โ need this
Think of it as zooming out
Your chart is at Customer level. The regional total is one level above. EXCLUDE temporarily zooms out to get that number then brings it back for the division.
Each customer's share of their region.
| Region | Customer | Order | Sales |
|---|---|---|---|
| East | Alice | #1 | 150 |
| East | Alice | #2 | 150 |
| East | Bob | #1 | 100 |
| West | Carol | #1 | 400 |
| West | Dan | #1 | 100 |
| West | Dan | #2 | 100 |
โ Without EXCLUDE
SUM([Sales])รทSUM([Sales]) = 100% for everyone. Dividing a number by itself โ there's no way to reach the regional total from a customer row.
โ With EXCLUDE ยท Alice=75%, Bob=25%
EXCLUDE drops Customer from the denominator, rolling up to Region. Alice=300รท400=75%. Bob=100รท400=25%. Adds to 100%. โ
WHEN THE VALUE MUST STAY LOCKED
"How many customers spent
over 250 in total, by region?"
The customer total must be calculated at Customer level and stay there, even when Customer leaves the chart.
INCLUDE and EXCLUDE both react to the chart.
FIXED ignores the chart entirely.
Like writing in permanent marker
FIXED calculates its value before Tableau draws the chart. Change the chart, add filters, remove dimensions โ that value doesn't move. It's locked.
Without FIXED, the chart breaks the count.
| Customer | FIXED Total | Over 250? | Region |
|---|---|---|---|
| Alice | 300 | โ Yes | East |
| Bob | 100 | โ No | East |
| Carol | 400 | โ Yes | West |
| Dan | 200 | โ No | West |
โ Without FIXED
Remove Customer from view โ SUM becomes region total. East=400 โ flagged. West=600 โ flagged. Regions pass the test, not customers. Wrong.
โ With FIXED โ East: 1, West: 1
Customer totals locked before chart draws. Alice โ, Carol โ. Bob and Dan don't qualify. Correct count survives the view change.
COUNTD( IF { FIXED [Customer]:SUM([Sales])}>250 THEN [Customer] END )Two steps. Every time.
Define what level is on your chart, then what level is missing.
Where does the missing level sit?
More detailed โ INCLUDE
Less detailed โ EXCLUDE
Must ignore the chart โ FIXED
Read the question. Which LOD?
"Average order value per customer, shown by region"
INCLUDE"Each product's share of its category total"
EXCLUDE"Customers whose total spend ever exceeded 500"
FIXED"Max sales per order, summarised by salesperson"
INCLUDE"Each region's contribution to the company total"
EXCLUDESpotted the pattern? It's always about where the missing level sits.
Two levels?
Reach for a LOD.
Next time a formula gives you the wrong number, stop and ask:
"What are the two levels hiding in this question?"
Mary leads Tableau Tuesdays, the weekly community sessions where members break down tricky Tableau concepts together. LOD expressions are her personal favourite feature.