Creates a Level of Detail field, which controls the granularity at which an aggregation is computed.
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.
The type of aggregation to apply. Supports standard aggregations like sum, average, count, min, max, and distinct-on aggregations.When the following aggregations are used, the custom_primary_key_sql parameter is required:
The grouping strategy and the field to use to apply it, specified as grouping_strategy: [ field_name ]. Refer to the Examples section to see an example with complete syntax.The grouping strategy must be one of the following:
always_include - Adds specified dimensions to the query’s grouping, forcing a finer level of detail
always_exclude - Removes specified dimensions from the grouping, producing a coarser aggregation
fixed - Defines an absolute level of detail, replacing all query groupings
A field reference that defines the key to use for deduplication when using *_distinct_on aggregate types, specified using ${} syntax. This allows you to aggregate over a different level than the view’s primary key, such as summing amounts by order ID when your view is at the order items level.This parameter is required when the following aggregate_types are used: