How it works
The easiest way to understand an LoD measure is to read it as SQL. For example, thisavg_customer_lifetime_spend LoD first sums each customer’s order amounts, then averages those per-customer totals at whatever grain the query is run. In this example, that’s by country:
level_of_detail block defines the inner query: fixed: [customers.id] with aggregate_type: sum produces one summed row per customer — that’s the first aggregation. The measure’s aggregate_type: average then takes those per-customer totals and averages them at the query’s grain. That’s the “aggregation of an aggregation” shape: a per-customer SUM feeding into a per-country AVG.
Note that the outer GROUP BY customers.country clause comes from the dimensions selected in the query, not the LoD definition itself.
Syntax
Properties
The name of the measure. Measure names must:
- Be unique within the view
- Start with a letter
- Contain only alphanumeric characters and underscores
Examples
Customer lifetime revenue
Fixed level of detail
Exclude dimensions from grouping
Sum distinct on with custom primary key
Selectively ignore a specific global filter
Replace a cancelled filter with a different value
Compare with cancel_query_filters (all-or-nothing)

