All topics
Metrics / 37 guides
dbt Semantic Layer
Semantic models, metrics, time comparisons, queries and integrations with MetricFlow and the latest YAML spec.

Getting started
Semantic models
- How to define entities in dbt (primary, foreign, unique, natural)
- How to define categorical and time dimensions in dbt
- How to set the default time dimension of a semantic model (agg_time_dimension)
- How to join two semantic models in dbt (via entities)
- How to define a dimension from a SQL expression in dbt
- How to reference the model in a semantic model in dbt Fusion (no ref())
Measures
Metrics
Time comparisons
- How to define a YTD or MTD metric in dbt (grain_to_date)
- How to define a rolling 12-month metric in dbt (window)
- How to compare a metric with the prior year in dbt (offset_window)
- How to calculate growth % vs prior period in dbt
- How to calculate YTD growth % vs prior year in dbt (derived metric)
- How to use a fiscal calendar in the dbt time spine
Querying
- How to group a metric by month, quarter or year in dbt (metric_time__month)
- How to filter a metric query in dbt (--where)
- How to see the SQL generated by the dbt Semantic Layer (--compile)
- How to list metrics and dimensions available in dbt (dbt sl list)
- How to define a saved query in dbt
- How to export a saved query as a table in dbt (exports)
Integrations
Errors and fixes
- How to fix SemanticModelDeprecated warnings from the example folder
- How to fix dbt sl query failing because there is no successful production job
- How to query lowercase quoted Snowflake columns in a semantic model
- How to fix "metric not found" or "dimension not found" in dbt
- How to debug a metric that returns the wrong number in dbt (check the compiled SQL)