pbPassingBI
/
Calculations advanced 12 min

Level of detail expressions

FIXED, INCLUDE and EXCLUDE — computing at a granularity other than the view.

What you'll be able to do
  • Choose between FIXED, INCLUDE and EXCLUDE
  • Write an LOD to solve a customer-cohort problem
  • Explain where LODs sit in the order of operations

The problem LODs solve

Normally a calculation is computed at the level of detail of the view. If your view is by Region, SUM([Sales]) gives sales per region — you can't easily also show sales per customer in the same view.

LOD expressions break that constraint. They let you attach specific dimensions to an aggregate, independent of what's on the shelves.

FIXED

{FIXED [Customer ID] : SUM([Sales])} computes total sales per customer, no matter what's in the view. It ignores the view's dimensions entirely and uses only the ones you name.

This is the workhorse. Customer lifetime value, first purchase date per customer, percent of total against a fixed denominator — all FIXED.

{FIXED : SUM([Sales])} with no dimensions computes a single grand total across the whole (filtered) data set.

INCLUDE and EXCLUDE

{INCLUDE [Customer ID] : SUM([Sales])} uses the view's dimensions plus Customer ID. Useful when you want a finer computation than the view, then re-aggregate — for example the average customer spend per region: AVG({INCLUDE [Customer ID] : SUM([Sales])}).

{EXCLUDE [Region] : SUM([Sales])} uses the view's dimensions minus Region. This is how you compute a total that stays constant while you break the view down — the denominator in a percent-of-total, say.

Unlike FIXED, both respond to what's on the shelves.

Order of operations, again

FIXED is computed before dimension filters take effect — it sits after them in the pipeline but before measure filters, and crucially it does not see dimension filters applied at view level. Promote a filter to context if you need FIXED to respect it.

INCLUDE and EXCLUDE are computed after dimension filters, so they behave more intuitively with quick filters.

A worked example

Cohort analysis: label each customer by the year of their first order.

{FIXED [Customer ID] : MIN([Order Date])} gives each customer's first order date regardless of the view. Wrap it — YEAR({FIXED [Customer ID] : MIN([Order Date])}) — and you have a cohort dimension you can drop on Colour to see how each year's intake behaves over time.

Key points
  • FIXED ignores view dimensions; INCLUDE adds to them; EXCLUDE removes from them
  • FIXED does not see view-level dimension filters unless they are in context
  • Nest an LOD inside an aggregate to re-aggregate: AVG({INCLUDE ...})
Check yourself