Skip to main content
This parameter is useful for creating metrics that remain consistent across different groupings, such as customer-level totals or category-level averages. LoD fields are dimensionalized, enabling you to perform an additional layer of aggregation - e.g. average customer lifetime spend.
You can also create LoD fields in the workbook! In the field browser of a query tab, click the on a dimension and then Modeling > New level of detail field.

Syntax

<dimension_name>:
  sql: <field>
  group_by:
    aggregate_type: <aggregation>
    <grouping_strategy>: [<field_name>]
    cancel_query_filters: <true_false>

Properties

dimension_name
object
The name of the dimension. Dimension names must:
  • Be unique within the view
  • Start with a letter
  • Contain only alphanumeric characters and underscores

Examples

Customer lifetime spend
customer_lifetime_spend:
  sql: ${sale_price}
  label: Customer Lifetime Spend
  group_by:
    aggregate_type: sum
    always_include: [user_id]
    cancel_query_filters: true
Fixed level of detail
category_total:
  sql: ${revenue}
  group_by:
    aggregate_type: sum
    fixed: [category]
Exclude dimensions from grouping
overall_average:
  sql: ${score}
  group_by:
    aggregate_type: average
    always_exclude: [region]