Tableau / Intermediate: calculation and interaction scope / Lesson 8
LOD, FIXED, INCLUDE, EXCLUDE and scope
Define calculation detail independently or relative to view detail and explain how filter stages affect the resulting population.
On this page
Lesson goals
- Compare FIXED, INCLUDE and EXCLUDE intentions.
- Trace ordinary dimension versus context filtering.
- Avoid summing repeated coarse-grain results.
Name requested detail
LOD expressions let a calculation request a detail other than the visible mark grouping. FIXED names its dimensions independently of the view. INCLUDE adds specified dimensions to view detail; EXCLUDE removes specified dimensions from it. The choice follows the question, not a desire to repair any duplicate value. Product totals, average customer totals and regional denominators need different contracts. State source grain, view grain and requested calculation grain before writing braces. LOD still depends on correct data and source support; it does not repair a physical join that already duplicated sales facts.
Read a FIXED denominator
The first fragment uses a table-wide FIXED sales total and aggregates that repeated constant with MIN before dividing the mark’s sales. In the fixture the unrestricted denominator is 60. An ordinary Region=North dimension filter can leave that denominator at 60 while numerator becomes 30, yielding 50%. If Region is context, the relevant FIXED population can become North and the ratio 100%. These are reasoned expectations under the documented simple pipeline, not engine results. Calculation modifiers and filters are not authorization bypasses; an approved upstream security restriction remains part of the data contract.
SUM([Sales]) / MIN({ FIXED : SUM([Sales]) })
Assume the simple fixture and only the stated filter stage difference. North’s 30 is 50% of 60 or 100% of context-limited 30. No Tableau execution occurs.
Trace filter precedence
FIXED is evaluated before ordinary dimension filters in the relevant pipeline, while context and earlier restrictions can affect it. INCLUDE and EXCLUDE have a different relationship to dimension filtering. Do not summarize this as FIXED ignores all filters. Extract and data-source restrictions can already remove facts. List the actual filter stages and expected population for each expression. A user can legitimately want a stable overall denominator, but another report may require within-selection share. Make that distinction explicit rather than moving a filter to context merely because one percentage looks more familiar.
Model coarse-grain repetition
A regional LOD value can repeat across several product marks within that region. Adding those repeated values is not necessarily a regional total. The second program compares North’s fixed 30 repeated for two product marks with its single intended regional total. It demonstrates grain replication rather than Tableau’s query implementation. Here, 60 comes from explicitly adding the two displayed regional replicas, for example outside Tableau or with a table calculation across Product marks. Tableau normally replicates a coarser LOD at finer view detail, and changing its shelf aggregation from SUM to MIN or AVG can be ignored in that case. Distinguish native replication from an explicit aggregation over replicas, then verify view changes and grand-total settings separately. A correct result at one view grain can become misleading after a new dimension is introduced, even though the LOD expression text stays identical.
regional_total = 30
product_marks_in_north = 2
repeated = [regional_total] * product_marks_in_north
print(sum(repeated))
print(min(repeated))
60
30
60 is the sum of duplicated regional values;30 is the single regional total. This does not execute an LOD expression.
Review LOD and view changes
Test no region filter, ordinary North filter, context North filter and a view with added Product detail. Specify expected denominators, marks and totals. Include unmatched keys and duplicate source facts in quality review rather than relying on LOD as deduplication. This course runs only repeated-value arithmetic. Actual LOD parsing, connector translation and filter evaluation remain untested. A reviewable explanation states every grain and stage, then justifies the outer aggregation so readers understand why a stable value repeats and when that repetition must not be added as new evidence.
Common errors and fixes
FIXED is said to ignore every filter
- Why it happens
- Ordinary dimension behavior was generalized to earlier restrictions.
- How to fix it
- Trace extract, source, context and later filter stages explicitly.
- Prevent it next time
- Keep ordinary-versus-context acceptance cases.
Repeated regional LOD values are added as new sales
- Why it happens
- Calculation grain was coarser than mark grain.
- How to fix it
- Choose the justified outer aggregation and verify the intended entity total.
- Prevent it next time
- Test adding a dimension without changing the formula.
LOD hides an already duplicated physical join
- Why it happens
- A modeling defect was treated as a view-detail problem.
- How to fix it
- Repair source grain and keys before calculation design.
- Prevent it next time
- Reconcile absolute fact totals before LOD acceptance.
Check your understanding
1. Why can North share be 50% with an ordinary filter and 100% with context?
Show worked solution
The ordinary filter can reduce the numerator after a table-wide FIXED denominator was computed as 60. Context establishes North’s 30 before that FIXED calculation. Both can implement valid but different population questions. Define the intended denominator and stage instead of choosing the percentage that looks nicer.
2. What changes when Product is added to a regional LOD view?
Show worked solution
The regional result can repeat on each product mark while its calculation grain stays regional. Summing those copies can multiply the amount. Review marks and outer aggregation, then compare with the one-region oracle. An unchanged expression does not guarantee unchanged interpretation after view detail changes.
Key takeaways
- LOD specifies calculation grain; view grain and filter stage still matter.
- Repeated coarse-grain results must not become duplicated facts.