1. Define semantic models
Group tables by business entity. Set the default time dimension and declare entities to anchor joins.
Understand how MetricLayer generates MetricFlow YAML and adapt the snippets for your semantic models, measures, and metrics.
Group tables by business entity. Set the default time dimension and declare entities to anchor joins.
Measure definitions describe aggregation and expressions. Dimensions capture grain, filters, and categoricals.
Wrap core measures in MetricFlow metrics, declare filters, and expose them to dbt Cloud or the Semantic Layer API.
semantic_models: - name: ecommerce_orders model: ref('stg_orders') defaults: agg_time_dimension: order_date entities: - name: order type: primary - name: customer type: foreign dimensions: - name: order_date type: time type_params: time_granularity: day - name: channel type: categorical measures: - name: total_revenue agg: sum expr: revenue
metrics: - name: revenue type: simple type_params: measure: total_revenue filter: - field: order_date operator: ">=" value: "2023-01-01"