Skip to main content

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.

Prerequisite

This recipe builds on the filtered category revenue metric from Revenue for a specific category. Complete that recipe first.

When would you use this?

  • A stakeholder asks “What percentage of our revenue comes from beverages?” and you need a ratio they can slice by time, location, or truck.
  • You want a governed share metric so every dashboard shows the same number without anyone hand-rolling a division formula.

What this recipe builds

A ratio metric that calculates the filtered category share out of the total revenue. Because both sides are named metrics, a change to the filter in the underlying metric automatically flows through to the share. The example below computes the share of beverages from a food-truck menu dataset, but the same pattern works for any category. Honeydew offers two flavors of share metric depending on how you want the denominator to behave when users add grouping dimensions.
This recipe uses the filtered metrics concept. See the documentation for the full technical reference.

Use case 1 - Share within the current grouping

When a user slices this metric by a dimension - for example, country - the denominator becomes total revenue for that country. The share answers: “Of this country’s revenue, how much came from beverages?”
order_detail.revenue_from_beverages / order_detail.revenue

Example - sliced by country

Each country’s denominator is that country’s own total revenue:
CountryBeverage revenueCountry totalBeverage share
India$51.8M$1,093.4M4.7%
Germany$50.1M$1,030.8M4.9%
Brazil$49.8M$991.3M5.0%
Australia$46.8M$951.0M4.9%
United States$49.2M$947.7M5.2%

Use case 2 - Share of the global total

When a user slices this metric by any dimension, the denominator stays the same - total revenue across the entire dataset. The share answers: “Of all our revenue, how much came from beverages in this slice?” The group by () clause tells Honeydew to remove all dimensions from the denominator’s grouping context. Filters still apply, but grouping dimensions do not change the denominator.
order_detail.revenue_from_beverages / order_detail.revenue group by ()

Example - sliced by country

Every country’s denominator is the grand total ($10.1B), so the values represent each country’s contribution to the overall beverage revenue:
CountryBeverage revenueGrand totalBeverage share
India$51.8M$10.1B0.51%
Germany$50.1M$10.1B0.50%
Brazil$49.8M$10.1B0.49%
Australia$46.8M$10.1B0.46%
United States$49.2M$10.1B0.49%
The shares across all countries sum to ~5.0% - the global beverage share. Each row tells you how much of the entire company’s revenue that country’s beverages represent.

How the two behave differently

Same data, side by side:
CountryBeverage revenueUse case 1 (per-country)Use case 2 (global)
India$51.8M4.7%0.51%
Germany$50.1M4.9%0.50%
Brazil$49.8M5.0%0.49%
  • Use case 1 - each country’s denominator is its own total. Answers “what share of this country’s revenue is beverages?”
  • Use case 2 - every row divides by the grand total. Answers “what share of all revenue is this country’s beverages?”