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?
- Finance reviews need gross profit; weekly ops meetings need revenue - the same dashboard should serve both without anyone switching reports.
- A CFO wants one governed performance metric that switches between revenue, food cost, and margin depending on the meeting.
- A BI developer is tired of maintaining three nearly identical dashboards for different financial views - they want one dashboard where a filter controls which calculation runs.
- Your semantic layer needs to replicate the behavior of a BI tool parameter: the user picks a value from a list, and a metric’s calculation changes accordingly.
What this recipe builds
In traditional BI tools, a parameter is a user-controlled input that can change a calculation. Users pick a value from a list, and selecting it changes which formula runs behind the scenes. Honeydew implements this through two components working together:- A disconnected parameter entity (
dim_financial_view) that holds the values a BI user can filter on. - The
GET_FIELD_SELECTION()function inside a metric, which reads whatever value the BI user has filtered on and routes to the correct calculation.
Architecture
| User filters | GET_FIELD_SELECTION returns | Metric used |
|---|---|---|
financial_view = 'Revenue' | 'Revenue' | Top-line revenue |
financial_view = 'Food Cost' | 'Food Cost' | Ingredient cost |
financial_view = 'Gross Profit' | 'Gross Profit' | Revenue minus order cost |
| No filter | 'Gross Profit' (default) | Revenue minus order cost |
Steps
Create the parameter entity
The
dim_financial_view entity is disconnected - it has no relations to
any other entity. It exists purely to carry the parameter values that a BI
user can filter on. Its dataset is an inline SQL VALUES statement - no
warehouse table is required.- UI
- YAML
- Click Add new entity.
- Choose Custom SQL.
- Paste the following SQL:
- Click Load columns.
- Rename the entity to
dim_financial_view. - Do not set any relations - continue and save.
Create the dynamic routing metric (revenue_dynamic)
Create a new metric called
revenue_dynamic. GET_FIELD_SELECTION(entity.attribute, default)
inspects the current query context and returns the value the BI user has
filtered on for dim_financial_view.financial_view. If no filter is applied,
it returns the default ('Gross Profit'). The CASE expression uses that
value to route to the correct existing metric.- SQL
- YAML
How the generated SQL changes
Honeydew compilesGET_FIELD_SELECTION at query time by substituting the
detected filter value directly into the CASE statement:
Sample output
Samerevenue_dynamic metric, 2022, top 5 cities - three different filter
selections show three different numbers:
| City | Gross Profit (default) | Revenue | Food Cost |
|---|---|---|---|
| Tokyo | $141M | $268M | $127M |
| Seoul | $140M | $268M | $128M |
| Delhi | $139M | $267M | $128M |
| London | $135M | $258M | $122M |
| New York City | $133M | $255M | $121M |
Routing reference
| Filter value | Routes to metric | Underlying SQL | Meaning |
|---|---|---|---|
Revenue | revenue | SUM(price) | Top-line revenue |
Food Cost | order_cost | SUM(quantity × cost_of_goods_usd) | Ingredient cost |
Gross Profit | profit | revenue - order_cost | Revenue minus order cost |
| (no filter) | profit | revenue - order_cost | Default view |
Using in a BI tool
- Drag
dim_financial_view.financial_viewas a filter. - Select a single value:
Revenue,Food Cost, orGross Profit. - Drag
order_detail.revenue_dynamicto the view. The metric uses the correct formula automatically. Switch the filter value to see the calculation change.
Key design notes
| Concern | Guidance |
|---|---|
| Disconnected entity | dim_financial_view must have no relations to any other entity. |
GET_FIELD_SELECTION default | The second argument is the fallback when no filter is applied. Useful when the BI tool does not support parameter defaults, or to protect against a report builder forgetting to set a value - unfiltered dashboards will still show meaningful data. |
| Extending to more variants | Add WHEN branches and corresponding metrics. The dim_financial_view dataset SQL just needs one more VALUES row. |
Related reading
- Metrics - reference for metrics that change behavior based on user filters
- Conditional filtering - deeper reference
on
GET_FIELD_SELECTIONpatterns - Entities - reference for disconnected entities