Level of detail ( LOD ) expressions, Calculation, Cohort analysis,Totals or averages across segments,Aggregates of aggregates, Binning aggregates.
Overview: Level of Detail Expressions
Level of detail expressions (which are sometimes also referred to as "LOD Expressions" or
"LOD Calculations") are useful for a variety of use cases, including:
Cohort analysis – comparing data for different subgroups
Totals or averages across segments
Aggregates of aggregates
Binning aggregates
Background: Row Level Expressions and View Level Expressions
In Tableau, expressions referencing unaggregated datasource columns are computed for
each row in the underlying table. In this case, the dimensionality of the expression is row level.
An example of a row-level expression is:
[Sales] / [Profit]
This calculation will be evaluated in each row of the database. For each row, the Sales value in
that row will be divided by the Profit value in that row, producing a new column with the result of
the multiplication (a profit ratio).
If you create a calculation with this definition, save it with the name [ProfitRatio], and then drag
it from the Data pane to a shelf, Tableau typically aggregates the calculated field for the view:
SUM[ProfitRatio]
By contrast, expressions referencing aggregated data source columns are computed at the
dimensionality defined by the dimensions in the view. In this case, the dimensionality of the
expression is view level. An example of a view-level expression is:
SUM(Sales) / SUM(Profit)
If you drag this calculation to a shelf (or type it directly on a shelf as an ad-hoc calculation),
Tableau encloses it in an AGG function:
AGG(SUM(Sales) / SUM(Profit))
This is what is known as an aggregate calculation.
Level of Detail Expression Syntax
A level of detail expression has the following structure:
{[FIXED | INCLUDE | EXCLUDE] : }