Semantic Layer

A semantic layer holds the business definitions between your data and the tools that read it: how each metric is calculated, which dimensions split it and how tables join. Dashboards, spreadsheets and AI assistants then return the same number for the same question.

Daniel Busch
Written by Daniel Busch · Chief of Staff · Updated

In short

  • Is: written definitions of metrics, dimensions and joins that every report, spreadsheet and AI assistant reads, instead of each tool calculating its own
  • Metrics layer: the older, narrower name for the part that defines metrics. The terms overlap; what matters is whether dimensions and joins are covered
  • Definitions as code: dbt's MetricFlow (YAML, open source since October 2025), Cube (YAML or JavaScript) and Looker's LookML, versioned like software
  • In marketing, the attribution model, the window and whether credit counts on click or conversion date are part of the definition: without them, ROAS is a formula shared by several metrics
  • For AI: in a 2023 benchmark, GPT-4 answered 16% of questions on an enterprise database correctly from the raw tables and 54% over a knowledge graph of it

What a semantic layer is

A semantic layer sits between your data and every tool that reads it, and holds the definitions each tool would otherwise write for itself:

  • Metrics: what is summed, counted or divided, which records count and on which date. Net revenue, for example: order values after discounts and refunds, without VAT.
  • Dimensions: what you can split by and which values exist, such as channel groups or markets.
  • Entities and joins: how orders, customers, sessions and ad spend connect, so a question across two tables doesn’t count an order twice.
  • Descriptions: one plain-language line per definition, for people and for AI assistants.

A request such as “net revenue by channel group, last month” goes to the layer, which writes the SQL. The dashboard, the spreadsheet and the assistant get the same number because they ask the same definition. Without a layer, every tool calculates its own. Benn Stancil described the problem in 2021: “Defining metrics in a BI tool localizes those definitions to that tool” (Benn Stancil).

Metrics layer

“Metrics layer” is the older, narrower name. Stancil’s essay “The missing piece of the modern data stack” (April 2021) called it “a centralized clearing house for how all metrics are calculated”. A metrics layer defines metrics: the aggregation, the filters, the time grain, and metrics built from other metrics, such as a ratio of a numerator and a denominator. Some vendors call it a metrics store.

One engine for it, MetricFlow, came from Transform, a company founded by former Airbnb data scientists. dbt Labs agreed to buy Transform in February 2023 and merged MetricFlow into the dbt Semantic Layer (dbt Labs). In MetricFlow, metrics sit in YAML files next to semantic models, which add entities, the join keys, and dimensions (dbt).

Semantic layer vs. metrics layer

Metrics layerSemantic layer
DefinesMetrics: aggregation, filters, time grainMetrics plus dimensions, entities and joins, descriptions, often access rules
AnswersHow is ROAS calculated?How is ROAS calculated, split by which channel grouping, joined how, shown to whom?
ServesReports that need one number per metricBI tools, spreadsheets, apps and AI assistants through one query interface

In practice the names overlap: LookML builds “semantic data models”, and Microsoft renamed Power BI’s datasets “semantic models” in November 2023 (Microsoft). The difference that matters is coverage. A layer that defines ROAS but not the channel grouping it is split by still lets two dashboards disagree.

Definitions as code: dbt, Cube and LookML

  • dbt Semantic Layer. Metrics are defined in the modeling layer, your dbt project, on top of existing models, and dbt handles the joins. Tools query them through the Semantic Layer APIs and integrations, AI assistants through dbt’s MCP server; you need a dbt Starter or Enterprise plan (dbt). MetricFlow itself is open source under Apache 2.0 since October 2025 (dbt Labs).
  • Cube. A data model in YAML or JavaScript: cubes map to tables, measures hold quantitative data such as units sold, dimensions categorical data, and views give data consumers one facade. Cube describes it as shared context for “AI agents, BI dashboards, and embedded analytics” (Cube).
  • LookML. Looker’s modeling language describes “dimensions, aggregates, calculations, and data relationships” in your SQL database, and Looker writes the SQL from it. LookML projects usually live in a Git repository (Google Cloud).

All three keep definitions in text files that are reviewed and versioned like code, and turn a request into SQL. BI tools carry layers of their own, such as Power BI’s semantic models or Tableau’s published data sources, whose updates “flow to all connected workbooks” (Tableau), but those live inside one vendor’s tools.

Why AI answers need a semantic layer

Ask an AI assistant “What was our ROAS last month?” on raw tables and it has to guess: gross or net revenue, with or without VAT, which conversions, which attribution model. It answers anyway, as fluently as if it knew (AI hallucination). In a 2023 benchmark on an enterprise SQL database, GPT-4 answered 16% of the questions correctly when prompted directly on the database and 54% when the same questions ran over a knowledge graph of it (arXiv). dbt Labs states the principle: “Metrics should not be probabilistic or depend on an LLM guessing each calculation” (dbt Labs).

MCP connects an assistant to a tool; the semantic layer decides what that tool’s numbers mean. “Split by channel for May this year. Show spend, net revenue, NC-ROAS and ROAS”, a question from one of the conversations in the demo below, names one dimension, a date range and four metrics, and each needs a definition before any assistant can answer.

Our view: in marketing, the model is part of the definition

A marketing metric isn’t defined until its attribution model, window and date are. Revenue divided by spend is only the formula: Meta’s ROAS on first touch and its ROAS on last touch are different metrics under one name, and our Meta Ads ROAS benchmark publishes both. A semantic layer for marketing has to carry the attribution model, the window, whether a conversion counts on its own date or its click’s date, net or gross revenue, and which orders count as new customers.

Customers ask about exactly this. About one in ten of the questions customers send us asks how a KPI, report or model is defined, from a market or product group definition to “did we change that definition?”. Two habits help: name the variant in the metric itself, the way customers write “NC Net Revenue” for net revenue from new customers, and put the model in every chart title.

How adtribute defines metrics, dimensions and models

FAQ about Semantic Layer

What is a semantic layer?

A set of business definitions between your data and the tools that read it: metrics with their formulas and filters, dimensions with their values, and the joins between tables. Dashboards, spreadsheets and AI assistants query the definitions instead of raw tables, so the same question gets the same number.

Do I need a semantic layer if I already have a BI tool?

Most BI tools have one inside, such as Power BI’s semantic models or Tableau’s published data sources, but it lives in that tool. Once a second tool, a spreadsheet or an AI assistant reads the same data, definitions drift unless they sit in one shared place.

How do I find out how a KPI is defined in adtribute?

Open the metric under Definitions › Attributes, or under Definitions › Fields if it is calculated from other metrics. Which orders or leads count is set in the conversion under Definitions › Events, the model under Definitions › Attribution Models. If in doubt, ask us in Slack or by email.

What happens to past numbers when a definition changes?

In adtribute, a change applies to all past dates the next morning, so comparisons over time stay consistent. Numbers exported before the change no longer match, so note the date of every definition change.