Skip to main content
Level of Detail (LoD) fields control the granularity at which an aggregation is computed. When used as a measure, an LoD produces an aggregation of an aggregation, such as an average of averages or a percent of total.
You can also create LoD fields in the workbook! See Creating level of detail fields for more information.

How it works

The easiest way to understand an LoD measure is to read it as SQL. For example, this avg_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:
The 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

object
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)