Calculations in Tableau
Maarten Van den Broeck
Content Developer at DataCamp
Data granularity is the level of detail in a model or decision making process. It tells you how detailed your data is (1)
e.g. Time-series analysis: per second | minute | hour | day | week | month | (...)
SUM(Sales)
SUM(Sales)
per region and per yearAdding dimensions on the Marks:
More dimensions = more data points
LOD Expressions provide a way to easily compute aggregations that are NOT at the level of detail of the visualization
Family of 3 functions:
INCLUDE
: calculating at a lower level of detailEXCLUDE
: calculating at a higher level of detailFIXED
: calculating at an exactly specified level of detailFIXED level of detail expressions compute a value using the specified dimensions, without reference to the dimensions in the view.
Calculating measures between various time dimensions:
e.g Swapping between daily and weekly calculations
{ FIXED [Day] : SUM(Sales)}
Calculating (sub) totals per categories:
e.g. % of Total { FIXED [Product] : SUM(Costs) } / { FIXED : SUM(Costs) }
Computing first or last data point per data subject:
e.g. First order date per customer
{ FIXED [Customer] : MIN([Order Date]) }
Cohort analysis:
Survival analysis:
Cohort analysis:
Survival analysis:
Calculations in Tableau