Skip to content

Commit e236d8c

Browse files
Update table to use order_shipping_cost and add visual order indicators
Generated-By: mintlify-agent
1 parent 131f60b commit e236d8c

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

references/metrics.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -896,18 +896,18 @@ The metric orders by the value being summed and takes the first occurrence for e
896896

897897
**Example: Summing order shipping costs**
898898

899-
Consider a model containing `order_id`, `order_item_id`, and `order_shipping_amount`:
900-
901-
| order_id | order_item_id | order_shipping_amount |
902-
|----------|---------------|-----------------------|
903-
| 1 | 1 | 10 |
904-
| 1 | 2 | 10 |
905-
| 2 | 3 | 20 |
906-
| 2 | 4 | 20 |
907-
| 2 | 5 | 20 |
908-
| 2 | 6 | 30 |
909-
910-
If you want to sum shipping amounts for all orders, you need to deduplicate by `order_id`. When `order_id` is the distinct key, the first `order_shipping_amount` in ascending order will be taken for each order. In this example, order 1 contributes 10 and order 2 contributes 20 (the first value when ordered ascending), giving a total of 30:
899+
Consider a model containing `order_id`, `order_item_id`, and `order_shipping_cost`:
900+
901+
| order_id | order_item_id | order_shipping_cost |
902+
|----------|---------------|---------------------|
903+
| 1 🟦 | 1 | 10 |
904+
| 1 🟦 | 2 | 10 |
905+
| 2 🟩 | 3 | 20 |
906+
| 2 🟩 | 4 | 20 |
907+
| 2 🟩 | 5 | 20 |
908+
| 2 🟩 | 6 | 30 |
909+
910+
If you want to sum shipping costs for all orders, you need to deduplicate by `order_id`. When `order_id` is the distinct key, the first `order_shipping_cost` in ascending order will be taken for each order. In this example, order 1 🟦 contributes 10 and order 2 🟩 contributes 20 (the first value when ordered ascending), giving a total of 30:
911911

912912
<Tabs>
913913
<Tab title="dbt v1.9 and earlier">

0 commit comments

Comments
 (0)