Prerequisite
This recipe builds on the fixed-grainorder_total_revenue metric
from Average order value. Complete that
recipe first.
When would you use this?
- Operations needs to identify premium trucks - those where more than half of orders exceed $50 - to decide which locations to prioritize for higher-end menu items.
- A product manager asks “What share of orders are high-value?” and you need a metric that works across any grouping dimension.
- You want a threshold that adapts to the data distribution rather than a hard-coded dollar amount.
What this recipe builds
A ratio metric that counts orders above a threshold and divides by total orders. The threshold is evaluated at order grain using the fixed-grain inner metric (order_total_revenue), then the
share is computed at user context.
The recipe shows two approaches to defining the threshold:
Use case 1 - Fixed dollar threshold
A hard-coded threshold, that answers: “What percentage of orders exceed 50 dollars” Use this when the business has a specific dollar cutoff that defines “high value” - for example, a promotion tier or a pricing benchmark.- SQL
- YAML
Example - sliced by country
Seoul 2022, top trucks by AOV:
Trucks 260 and 269 have more than half their orders above $50,
making them candidates for premium menu expansion.
Use case 2 - Percentile-based threshold
A data-driven threshold that adapts to the distribution. Instead of a fixed dollar amount, the cutoff is the 75th percentile of order revenue. The share answers: “What percentage of orders fall in the top quartile?” Use this when there is no natural dollar cutoff, or when you want the definition of “high value” to move with the data over time.1
75th percentile of order revenue
The global 75th percentile, computed with The current global value is $57.00.
group by () so it
stays the same regardless of user grouping. Filters still
apply - filtering to a single country gives that country’s
75th percentile.- SQL
- YAML
2
Top quartile order share
Orders above the 75th percentile as a share of all orders. The
FILTER clause references p75_order_revenue - the percentile
metric from the previous step - so the threshold adapts as the
data distribution changes.- SQL
- YAML
Example
The global top quartile share is approximately 24.8% - close to the expected 25% for a 75th-percentile cutoff. The small deviation comes from orders that land exactly on the percentile boundary.How the two behave differently
Key design notes
Related reading
- Average order value - prerequisite recipe
- Filters -
reference on
FILTER (WHERE ...) - Ratio metrics - using filtered metrics inside ratio expressions
- Fixed empty grouping -
locking the percentile with
group by ()