Skip to main content

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:
  1. A disconnected parameter entity (dim_financial_view) that holds the values a BI user can filter on.
  2. The GET_FIELD_SELECTION() function inside a metric, which reads whatever value the BI user has filtered on and routes to the correct calculation.
This recipe uses the conditional filtering concept. See the documentation for the full technical reference.

Architecture

Steps

1

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.
  1. Click Add new entity.
  2. Choose Custom SQL.
  3. Paste the following SQL:
  4. Click Load columns.
  5. Rename the entity to dim_financial_view.
  6. Do not set any relations - continue and save.
2

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.

How the generated SQL changes

Honeydew compiles GET_FIELD_SELECTION at query time by substituting the detected filter value directly into the CASE statement:

Sample output

Same revenue_dynamic metric, 2022, top 5 cities - three different filter selections show three different numbers:

Routing reference

Using in a BI tool

  1. Drag dim_financial_view.financial_view as a filter.
  2. Select a single value: Revenue, Food Cost, or Gross Profit.
  3. Drag order_detail.revenue_dynamic to the view. The metric uses the correct formula automatically. Switch the filter value to see the calculation change.

Key design notes

  • Metrics - reference for metrics that change behavior based on user filters
  • Conditional filtering - deeper reference on GET_FIELD_SELECTION patterns
  • Entities - reference for disconnected entities