Documentation Index
Fetch the complete documentation index at: https://honeydew.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
When would you use this?
- Operations asks “Which trucks have the highest average daily sales?” - not the total, but the daily average, so high-volume trucks aren’t just rewarded for operating more days.
- You need a metric that says average daily revenue per country when sliced by country, but average daily revenue per truck when sliced by truck - same metric, adaptive grouping.
- Finance wants to compare daily performance across regions that operate different numbers of days.
What this recipe builds
Two metrics demonstrating the dynamic grouping pattern. The inner metric usesGROUP BY (*, order_header.order_date) - the
* means whatever the user is grouping by, plus date - so the
inner SUM always computes daily totals regardless of the outer
dimension. The outer AVG then averages those daily values.
Steps
Daily revenue (inner)
Revenue grouped by user context plus date. The
* inherits
whatever dimension the user is querying. This is the building
block for the average daily revenue metric.- SQL
- YAML
Example - sliced by country
| Country | Avg daily revenue |
|---|---|
| Australia | $917,928 |
| Germany | $913,841 |
| Brazil | $812,501 |
| India | $780,411 |
| United States | $676,420 |
Key design notes
| Concern | Guidance |
|---|---|
Dynamic vs fixed GROUP BY | GROUP BY (*, date) is dynamic - the inner grain follows user context plus date. This differs from fixed GROUP BY (order_id) used in the AOV recipe, which never changes grain. |
Related reading
- Dynamic grouping -
reference on
GROUP BY (*, entity.field)