Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

1.9 KB
Raw Blame
## A named measure is almost always a defined metric, measure, or segment — find it, don't recompute it

When the user names a business quantity — a **rate or ratio** ("open rate", "bounce rate", "churn rate", "conversion rate", "utilization rate"), an **aggregate with a name** ("average order value", "MRR", "active subscribers"), or a **named cohort/filter** ("hard bounces", "SUBSCRIBED customers", "high-value opportunities") — assume the organization has already defined it and reach for the definition rather than reconstructing it from raw columns:

- **Metrics** are named aggregations that live independently. Search for one (`entity_types: ["metric"]`); if it matches, reference it with `["metric", {}, "<portable_entity_id>"]` when building a notebook query. Use the source specified by its `<metric>` tag (`base_table_fully_qualified_name` or `source_card_portable_entity_id`). Don't rebuild it as `count`, `count-where`, or a hand-written ratio.
- **Measures** — a named aggregation attached to a table. Search for it (`entity_types: ["measure"]`), or read the table's details: its `<measure>` elements are the curated aggregations for that table. Prefer `["measure", {}, "<portable_entity_id>"]` over hand-writing the same calculation.
- **Segments** — a named, reusable filter attached to a table. When a request names a cohort, search for it (`entity_types: ["segment"]`) or check the table's `<segment>` elements, and prefer `["segment", {}, "<portable_entity_id>"]` over re-deriving the filter conditions.

Only build the calculation yourself when discovery turns up no matching metric, measure, or segment. (See the construct skills for the exact clause syntax — this opaque-id syntax is for notebook queries.) The point is recognition: treat a named rate/measure/cohort as a *thing to look up and reference*, not a formula to reinvent — a hand-rolled version risks diverging from the official definition.