Skip to main content
A level of detail (LOD) field calculates an aggregation at a granularity you specify, independent of the dimensions in the query. Use them when you need a value like “lifetime spend per customer” or “first order date” to stay attached to every row, even as you add or remove other dimensions.

LOD basics

In a standard query, an aggregation is computed at the granularity of whatever dimensions are in the GROUP BY clause. Add a dimension and the aggregation regroups; remove one and it regroups again.An LOD field opts out of that behavior. You define the granularity once — for example, “per user” or “across the whole dataset” — and the value persists regardless of the dimensions in the query.
LODs can be mapped directly to a SQL equivalent.Consider the following example, a max_age_in_country LOD dimension that finds maximum user age within each country and attaches it to every user row.
SQL
The Omni definition for this LOD dimension would look like the following:
Omni model YAML
The fixed: [country] clause corresponds to the GROUP BY country in the inner query — one row per country, the level of detail. The join then carries that country-level value back to each user row, which is why the LOD behaves like a categorical dimension: every user in the same country shares the same max_age_in_country value.
LOD fields are useful any time you need a metric at a different grain than the rest of your analysis, for example:
  • A customer-level total used while breaking out by product category
  • A first-touch date used while analyzing activity over time
  • A grand total used while showing per-region values
Yes. When used as a dimension, an LoD produces a categorical value — one row per level of detail — which lets you perform an additional layer of aggregation (e.g., average customer lifetime spend).
Yes. When used as a measure, an LoD produces an aggregation of an aggregation, such as an average of averages or a percent of total.

Requirements

To create an LOD field, you’ll need Querier, Modeler, or Connection Admin permissions.

Creating a level of detail field

You can create an LOD field directly from the field browser in a workbook or in the model IDE.
1

Open the level of detail editor

  1. In the field browser of a query tab, hover over a dimension and click the icon that appears.
  2. Select Modeling > New level of detail field.
  3. Enter a display name for the field in the Field Label field.
2

Set the aggregation

Use the Aggregation dropdown to choose an aggregate type, such as Count distinct.
3

Choose a grouping strategy

Use the Level of Detail Grouping and Dimension(s) fields to pick a strategy and the dimensions that define your level of detail. See Grouping strategies below for more information.
4

Define optional fields

You can also add filters, define the field’s scope, and add a description and group label.
5

Save the field

Click Add to save the field. It appears in the field browser under your custom dimensions and behaves like any other field.
You can create LOD measures and dimensions in the model IDE with the level_of_detail parameter. For example:
LOD dimension definition
See the level_of_detail parameter references for measures and dimensions for the full list of supported parameters.
Promote the LOD field to the shared model to make it accessible in new and existing workbooks built on the model.

Grouping strategies

Three strategies control how the LOD field interacts with the dimensions in your query:

Common patterns

A few LOD patterns come up often enough that they’re worth recognizing on sight. Each example below shows the same field built two ways — the workbook editor inputs and the equivalent YAML in the model IDE — so you can pick whichever surface you’re working in.
See the level_of_detail parameter references for measures and dimensions for additional examples.

Customer lifetime spend

Calculate the total spend per customer so you can bucket customers ($0–100, $100–500, etc.) even while viewing orders by product category.
The fields in the LOD editor would look like the following:
  • Field to aggregate - Sale price
  • Aggregation - Sum
  • Level of Detail Grouping - Fixed
  • Fixed dimension(s) - User ID

First-touch cohort date

Find each user’s first order date so you can group users into acquisition cohorts.
The fields in the LOD editor would look like the following:
  • Field to aggregate - Order date
  • Aggregation - Min
  • Level of Detail Grouping - Fixed
  • Fixed dimension(s) - User ID
For a full walkthrough of building cohorts on top of an LOD field, see Build cohort analysis using level of detail.

Percent of total

Calculate the grand total of a metric so you can compare each row’s value to the total — for example, what percentage of total sales each region represents. The result is the company-wide total attached to every row, ready to divide against.
The fields in the LOD editor would look like the following:
  • Field to aggregate - Sales
  • Aggregation - Sum
  • Level of Detail Grouping - Exclude
  • Fixed dimension(s) - Region

Next steps