Calculations in Tableau
Maarten Van den Broeck
Content Developer at DataCamp
LOD expressions: three powerful formulas that allow us to calculate at a different level of detail than the data in the visualization.
FIXED
: calculating at an exactly specified level of detail.EXCLUDE
: calculating at a higher level of detail.INCLUDE
: calculating at a lower level of detail.Syntax: { INCLUDE [Dimension 1], [Dimension 2], ... : aggregation expression }
E.g.
Calculation will change if you add/remove dimensions from the view.
Underlying data:
Avg. Profit: AVG(Profit)
Avg. Profit per customer:
AVG({INCLUDE [Customer] : SUM(Profit)})
Syntax: { EXCLUDE [Dimension 1], [Dimension 2], ... : aggregation expression }
E.g.
Profit (per Product Category):
{ EXCLUDE [Product Id] : SUM([Profit]) }
FIXED
INCLUDE
EXCLUDE
Tableau executes filters in a specified order:
Calculations in Tableau