Data Engineering  /  dbt

๐Ÿ”„ dbt โ€” Data Build Tool 60 guides ยท updated 2026

Analytics engineering with SQL โ€” models, tests, sources, and Jinja macros that turn raw warehouse tables into trustworthy, documented data products.

dbt Semantic Layer: One Metric Definition Across Every BI Tool

Defining a single metric consistently, as covered in Metrics Layer, solves one instance of a recurring problem. The dbt Semantic Layer solves the same problem at architectural scale โ€” a complete semantic model of your business (metrics, dimensions, entities, and how they relate) that any BI tool can query and get identical answers from, without dbt itself becoming a BI tool.


What โ€œSemantic Layerโ€ Actually Means

A semantic layer sits between raw warehouse tables and the tools people use to ask questions of that data. Instead of every BI tool independently translating โ€œshow me revenue by region last quarterโ€ into its own SQL, the semantic layer holds the actual business logic โ€” what โ€œrevenueโ€ means, what โ€œregionโ€ means, how they relate โ€” and every connected tool sends a request through it rather than generating its own SQL from scratch.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
Looker โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ โ”‚
Tableau โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ Semantic โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ–ถ Warehouse
Hex โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ Layer โ”‚
Custom app โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ (MetricFlow)โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Every tool asks the semantic layer the same question the same way; the semantic layer generates correct, consistent SQL underneath, regardless of which tool asked.


Semantic Models: Metrics, Dimensions, and Entities

The Semantic Layer is built on semantic models, which formalize three concepts beyond just metrics:

models/marts/_semantic_models.yml
semantic_models:
- name: orders
model: ref('sales_summary')
entities:
- name: order
type: primary
- name: customer
type: foreign
dimensions:
- name: region
type: categorical
- name: order_date
type: time
type_params:
time_granularity: day
measures:
- name: revenue
agg: sum
expr: total_amount

Metrics, as covered in Metrics Layer, are then built on top of these semantic models, referencing their measures and dimensions.


Why Entities and Dimensions Matter Beyond Individual Metrics

Declaring region as a dimension once, on the semantic model, means any metric built from orders can be sliced by region automatically โ€” โ€œrevenue by region,โ€ โ€œorder count by region,โ€ โ€œaverage order value by regionโ€ all reuse the same dimension declaration rather than each metric needing to redefine what โ€œregionโ€ means and how to join to it.

This is the core difference from the narrower Metrics Layer: instead of defining calculations one at a time, youโ€™re defining the underlying semantic structure once, and metrics compose from it.


MetricFlow: The Engine Behind the Semantic Layer

MetricFlow is the query-generation engine that translates a semantic request (โ€œmonthly revenue, by region, for Q1โ€) into actual SQL against your warehouse, correctly handling joins between entities and aggregation at the requested dimension grain.

Terminal window
mf query --metrics monthly_revenue --group-by region --start-time 2026-01-01 --end-time 2026-03-31

This is what gets invoked underneath a BI toolโ€™s request when that tool is connected to dbtโ€™s Semantic Layer rather than querying the warehouse directly with its own generated SQL.


Connecting BI Tools to the Semantic Layer

The practical payoff shows up once multiple tools are connected โ€” a Looker dashboard, a Tableau report, and an analystโ€™s ad hoc query in Hex can all request โ€œmonthly_revenue by regionโ€ and get byte-for-byte identical numbers, because all three are routed through the same MetricFlow-compiled query logic rather than each toolโ€™s own SQL generation.

This matters most for organizations that have โ€” often unintentionally โ€” accumulated multiple BI tools over time, each with its own history of slightly-drifted metric definitions. The Semantic Layer doesnโ€™t retroactively fix existing dashboards, but it gives new ones, and gradually migrated old ones, a single source of truth to converge toward.


When the Semantic Layer Is Worth Adopting

SituationSemantic Layer value
Single BI tool, small team, few metricsLower โ€” a well-maintained Metrics Layer alone may suffice
Multiple BI tools, recurring โ€œwhy do these numbers differโ€ disputesHigh โ€” this is exactly the problem it solves
Data science and BI both need consistent metric accessHigh โ€” one definition, multiple consumption paths
Very early-stage project, metrics still actively being definedLower priority โ€” get the underlying models and tests solid first

Itโ€™s not a first-day investment for a brand-new dbt project โ€” it earns its value once you have enough models, enough consumers, and enough metric definitions that inconsistency has become an actual recurring problem rather than a theoretical risk.


Common Mistakes

Adopting the Semantic Layer before the underlying models and tests are solid. A consistent, tool-agnostic query layer on top of untested, unreliable models just serves the same wrong number to every tool consistently โ€” consistency isnโ€™t the same as correctness.

Treating dimensions and entities as an afterthought. The real payoff of the Semantic Layer over a narrower Metrics Layer comes from properly declared entities and dimensions enabling metric composition โ€” skipping this and only defining flat metrics gives up most of the benefit.

Expecting existing dashboards to automatically become consistent. The Semantic Layer provides a consistent source going forward; migrating existing, already-built dashboards to actually use it is separate, deliberate work.

Summary

ConceptRole
Semantic modelDeclares entities, dimensions, and measures for a set of data
MetricFlowCompiles semantic requests into correct, consistent SQL
Entities/dimensionsEnable metric composition and consistent slicing across dashboards
Multi-tool consistencyThe core payoff โ€” every connected tool gets identical answers

The Semantic Layer is the Metrics Layerโ€™s natural extension โ€” instead of defining individual calculations, youโ€™re defining the underlying business vocabulary once, letting every tool that speaks it get the same answer to the same question.