Metric Definition
A metric definition is a formal specification of what a metric is, how it is calculated, which dimensions it supports, and what rules or limitations apply.
A metric definition goes beyond a simple formula. It includes the calculation logic (sum of orders where status equals completed), the grain (daily, monthly, total), valid dimensions (product category, region, customer segment), filters or conditions (exclude test accounts), and metadata (owner, last updated, freshness SLA). The definition is structured so it can be referenced programmatically: BI tools, APIs, and dashboards can look up the definition and apply it consistently.
Metric definitions solve the problem of implicit assumptions. When a metric lives only in someone's SQL query, the definition is hidden: colleagues don't know whether revenue includes refunds, how multi-currency is handled, or whether it's a sum or average. A metric definition makes these explicit and discoverable. Definitions are typically YAML-based or stored in a metrics platform, version-controlled, and auditable.
Metric definitions enable metric composition: building new metrics from existing ones. For example, "profit margin" is defined in terms of "revenue" and "cost" metrics. When revenue changes, profit margin automatically reflects it. Definitions also support dimension bindings: specifying that a metric only makes sense with certain dimensions (e.g., "session duration" requires user ID or session ID).
Key Characteristics
- ▶Explicit calculation formula with supporting logic
- ▶Specifies valid dimensions and filter combinations
- ▶Documents assumptions and limitations
- ▶Version-controlled with change history
- ▶Includes ownership and freshness metadata
- ▶Supports metric composition and reuse
Why It Matters
- ▶Clarity: Removes ambiguity about what a metric is
- ▶Consistency: Same definition applies across all tools and contexts
- ▶Composability: Build complex metrics from simpler ones
- ▶Auditability: Track metric changes and who made them
- ▶Discoverability: Metric definitions act as queryable documentation
Example
` metric: name: monthly_recurring_revenue owner: finance_team description: Sum of active subscription values calculation: SUM(subscription_value) where: status = 'active' AND subscription_start_date <= CURRENT_DATE dimensions: [product, region, customer_segment] grain: month freshness_sla: 24_hours `
Coginiti Perspective
In SMDL, a metric definition is a measure declaration specifying the source expression, aggregation_type, and optional visibility. The 12 supported aggregation types (count, count_distinct, sum, avg, max, min, median, stdev, stdevp, var, varp, custom) cover standard statistical needs, while the custom type accepts arbitrary SQL for complex business calculations. These definitions are stored as code in .smdl files within the Analytics Catalog, so metric definitions follow the same version control and code review workflow as any other code artifact.
More in Semantic Layer & Metrics
Business Logic Layer
A business logic layer is the component of a semantic layer or data system that encodes business rules, calculations, and transformations, making them reusable and enforced across analytics.
Data Abstraction Layer
A data abstraction layer is a software or architectural component that sits between raw data sources and analytics consumers, providing unified access and hiding implementation complexity.
Data Semantics
Data semantics refers to the documented meaning, business context, and valid usage of data elements, including definitions, relationships, constraints, and governance rules.
Derived Metrics
Derived metrics are metrics calculated from other base metrics or dimensions rather than directly from raw fact tables, enabling metric composition and reducing calculation redundancy.
Dimension
A dimension is a categorical or descriptive attribute used to slice, filter, and organize metrics, such as product, region, customer segment, or date.
Governed Metrics
Governed metrics are business metrics with centrally defined calculations, owners, approval workflows, and enforced standards that ensure consistency and trustworthiness across all analytics consumers.
See Semantic Intelligence in Action
Coginiti operationalizes business meaning across your entire data estate.