Skip to main content
This is used to dedupe over a different aggregation level than the default behavior. For example, aggregation over an intermediate table or another key. This can be used for similar use cases to level-of-detail calculation.

Syntax

<measure_name>:
  sql: <field>
  aggregate_type: sum_distinct_on
  custom_primary_key_sql: ${<view_name>.<field_name>}

Properties

measure_name
object[]
The name of the measure.

Examples

distinct_price:
  sql: price
  aggregate_type: sum_distinct_on
  custom_primary_key_sql: ${id_from_other_table}
The combination of a Custom Primary Key and these specific aggregate types is best used in scenarios where you are aggregating a field based off of the primary key in another table.