When would you use this?
- You need a governed metric that captures revenue for one specific product category, so analysts don’t each write their own filter.
- You are building a dashboard and want category-specific revenue baked into the metric layer rather than applied as a BI filter.
- You want to track how a single category’s revenue changes over time, by location, or by channel.
What this recipe builds
A filtered metric that isolates revenue for a single category. The filter is baked into the metric definition using SQLFILTER (WHERE ...). BI users get a pre-governed metric they
can slice freely without needing to know the underlying filter
condition.
The example below uses Beverage, Dessert, and Snack
from a food-truck menu dataset, but the same pattern works for any
category you want to track.
Steps
1
Revenue from beverages
Revenue from beverage items only. The filter is part of the
metric - users never need to add it manually.
- SQL
- YAML
2
Revenue from desserts
The same pattern applied to a second category. Repeat for as
many categories as you need.
- SQL
- YAML
3
Revenue from snacks
- SQL
- YAML