Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions references/metrics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,10 @@ The `sum_distinct` metric requires:

The metric orders by the value being summed and takes the first occurrence for each unique combination of distinct keys. If there are different values for the same distinct key combination, the first one encountered will be used.

<Note>
Deduplication always happens globally on the `distinct_keys` you define, regardless of which dimensions you select in a query. The resulting total is the same value across every output row — selecting an extra dimension does not break the total down per group. If you need per-group results, set `distinct_keys` to include the grouping field.
</Note>

**Example: Summing order shipping costs**

Consider a model containing `order_id`, `order_item_id`, and `order_shipping_cost`:
Expand Down Expand Up @@ -1073,6 +1077,10 @@ The `average_distinct` metric requires:

The metric orders by the value being averaged and takes the first occurrence for each unique combination of distinct keys. If there are different values for the same distinct key combination, the first one encountered will be used.

<Note>
Deduplication always happens globally on the `distinct_keys` you define, regardless of which dimensions you select in a query. The resulting average is the same value across every output row — selecting an extra dimension does not break the average down per group. If you need per-group results, set `distinct_keys` to include the grouping field.
</Note>

**Example: Averaging order shipping costs**

Consider a model containing `order_id`, `order_item_id`, and `order_shipping_cost`:
Expand Down
Loading