OneNoughtOne
0/308
Loading content...
Your analytics warehouse stores order volume in compressed form.
Table: orders
Instead of storing every order row, one row summarizes many identical orders.
Task: Compute the average number of items per order across the full dataset.
Metric definition:
Output rules:
Supported submission environments:
orders:
| order_id | item_count | order_occurrences |
|----------|------------|-------------------|
| 10 | 1 | 500 |
| 11 | 2 | 1000 |
| 12 | 3 | 800 |
| 13 | 4 | 1000 |[
{"average_items_per_order":2.7}
]Explanation
Weighted items = 1*500 + 2*1000 + 3*800 + 4*1000 = 8900. Total orders = 3300. Mean = 8900/3300 = 2.696..., rounded to 2.70.
orders:
| order_id | item_count | order_occurrences |
|----------|------------|-------------------|
| 20 | 2 | 250 |
| 21 | 1 | 750 |[
{"average_items_per_order":1.25}
]Explanation
Weighted items = 2*250 + 1*750 = 1250, total orders = 1000, so the compressed mean is 1.25.
orders:
| order_id | item_count | order_occurrences |
|----------|------------|-------------------|
| 30 | 5 | 0 |
| 31 | 2 | 0 |
| 32 | 9 | 0 |[
{"average_items_per_order":0.0}
]Explanation
No effective orders exist because all occurrences are zero, so the denominator is 0 and the result must be 0.00.
Constraints