Back to Blog
Guides

What Is a Semantic Layer? Definition, Types, Tools and Examples

A semantic layer is a governed set of definitions that sits between the raw tables in a data warehouse and the people, BI tools and AI agents that query them. It maps columns and joins to business terms such as revenue, customer and active user, so each metric is defined once and returns the same number everywhere.

What a semantic layer is, how it works, the main types and tools (dbt, Cube, AtScale, Looker, Databricks, Mitzu), and a worked metric example with its SQL.

István Mészáros
István Mészáros

Co-founder & CEO

October 7, 2026
15 min read
What Is a Semantic Layer? Definition, Types, Tools and Examples

TL;DR

A semantic layer turns warehouse tables into named business concepts (entities, dimensions, metrics) and compiles every request for them into SQL, so a metric is defined once instead of in every dashboard. The main options are dbt Semantic Layer, Cube and AtScale (universal layers), LookML and Power BI semantic models (inside a BI tool), and Databricks metric views and Snowflake semantic views (inside the data platform). For AI, a semantic layer is the grounding an LLM or agent needs to stop guessing what columns mean; funnels and retention also need a query engine that encodes the method.

A semantic layer is the place where a company writes down what its data means. Instead of every analyst, dashboard and AI agent working out for themselves how to calculate revenue from an orders table, the calculation is defined once, given a name, and reused. Ask for net revenue by country in a BI tool, a spreadsheet or a chat window, and the semantic layer turns that request into the same SQL every time.

Why do semantic layers exist?

A warehouse table does not say what it means. A column called amount could be gross or net, with or without tax. So the logic gets written wherever it is needed, and soon finance and product report two different revenue numbers, each correct according to its own SQL. The fix, a shared business vocabulary, is old: Business Objects was granted a US patent for it in 1996 (Wikipedia). Two things brought it back: cloud warehouses let many tools query the same tables, and LLMs made plain-language questions possible, which only works if something tells the model what the columns mean.

How does a semantic layer work?

A semantic layer sits between the warehouse and everything that queries it. It usually holds definitions, not data: the tables stay where they are, and the layer generates SQL against them at query time, in four steps. Because that SQL comes from a stored definition, two people asking the same thing get the same query.

From a business question to SQL
  1. Model

    A data team maps tables to business concepts: which table holds orders, which column identifies the customer, which columns you can group by, and how tables join.

  2. Define

    Metrics are written on top: an aggregation, the expression it applies to, and any filters. Net revenue becomes a named object with one definition.

  3. Request

    A person, a BI tool or an AI agent asks for a metric by name, with the dimensions, filters and time grain it wants. Nobody writes the join.

  4. Compile and run

    The layer generates SQL in the warehouse's dialect and the warehouse executes it. Some layers add a cache or pre-aggregated tables.

Key components of a semantic layer

Vendors use different names, but most semantic layers have the same parts, plus a query interface (SQL, an API or a BI connector) and the compiler that generates the SQL.

ComponentWhat it isExample
EntitiesThe things your data is about and their keys. Entities are how tables join.customer, order, account
DimensionsAttributes you group or filter by, including time.country, plan, sales channel, order date
Measures and metricsAggregations over a column or expression, and calculations built from them.net revenue, order count, average order value
RelationshipsJoin paths and their cardinality, so the layer can join without double counting.orders to customers, many-to-one
MetadataDisplay names, descriptions and synonyms that people and LLMs read to find the right field."Net revenue: completed orders minus refunds"
Access rulesWho may see which metrics, rows and columns.regional managers see only their region

A semantic layer example: one metric, defined once

Here is a concrete example in the dbt Semantic Layer YAML spec (dbt v1.12 and later). A semantic model is one modelled table inside the layer: it declares the entities, dimensions and metrics that the table provides. The example has two. fct_orders holds one row per order and defines a net_revenue metric. dim_customers holds one row per customer and contributes the country dimension.

models:
  - name: fct_orders
    description: "One row per order."
    semantic_model:
      enabled: true
    agg_time_dimension: ordered_at
    columns:
      - name: order_id
        entity:
          type: primary
          name: order
      - name: customer_id
        entity:
          type: foreign
          name: customer
      - name: ordered_at
        granularity: day
        dimension:
          type: time
      - name: sales_channel
        dimension:
          type: categorical
    metrics:
      - name: net_revenue
        label: Net revenue
        description: "Completed orders, minus refunds."
        type: simple
        agg: sum
        expr: case when status = 'completed' then amount - refunded_amount else 0 end

  - name: dim_customers
    description: "One row per customer."
    semantic_model:
      enabled: true
    columns:
      - name: customer_id
        entity:
          type: primary
          name: customer
      - name: country
        dimension:
          type: categorical

Nothing in that file is a query. It says what an order is, how it relates to a customer, and how net revenue is calculated. A consumer then asks for the metric by name and chooses how to slice it:

dbt sl query --metrics net_revenue --group-by metric_time__month,customer__country

The layer works out that country lives on the customer table, finds the join through the shared customer entity, and compiles SQL of this shape (simplified for reading; the generated query is more verbose):

SELECT
  DATE_TRUNC('month', o.ordered_at) AS metric_time__month,
  c.country                         AS customer__country,
  SUM(
    CASE WHEN o.status = 'completed'
         THEN o.amount - o.refunded_amount
         ELSE 0 END
  )                                 AS net_revenue
FROM analytics.fct_orders AS o
LEFT JOIN analytics.dim_customers AS c
  ON o.customer_id = c.customer_id
GROUP BY 1, 2;

Ask for the same metric by week and sales channel and the join disappears, the grain changes, and the CASE expression stays identical. The rule that refunds are subtracted and cancelled orders are excluded lives in one line of the definition, not in forty dashboards. Change it there and every consumer picks it up.

Types of semantic layer

Semantic layers differ mainly in where the definitions live. That decides which tools can use them.

TypeWhere definitions liveExamplesTrade-off
BI-tool semantic layerInside one BI productLooker (LookML), Power BI semantic modelsDeep integration with that tool; others need a connector.
Universal (headless) semantic layerA separate service between the warehouse and every consumerCube, AtScale, dbt Semantic LayerOne definition for many tools; another system to run.
Warehouse-native semantic layerObjects in the data platform's own catalogDatabricks Unity Catalog metric views, Snowflake semantic viewsGoverned like the tables; tied to that platform.
Domain-specific semantic layerInside a tool built for one kind of analysisMitzu (product analytics)Expresses events and funnels; does not serve every BI tool.

Two neighbouring terms cause confusion. A metrics layer is the part of a semantic layer that defines metrics; the terms are often used interchangeably. A semantic model is a single modelled unit inside a layer: dbt uses the term for one annotated table, and Microsoft uses it for the data model behind Power BI reports. In knowledge management, "semantic layer" can also mean a knowledge graph of taxonomies and ontologies; this guide covers the analytics meaning.

Benefits of a semantic layer

  • One number per metric. Revenue in the board deck matches revenue in the product dashboard, because both call the same definition.
  • Self-service without SQL. People pick a metric and a dimension. The join logic is no longer something each user has to get right.
  • Changes happen once. When the definition of an active user changes, you edit one object instead of hunting through reports.
  • Grounding for AI. An LLM that reads named, described metrics has far less to guess than one that reads raw column names.

Semantic layer tools compared

There is no single best semantic layer tool. The right one depends on where your definitions already live and who consumes them. Each row links to the vendor documentation it was checked against in October 2026.

Semantic layer tools
ToolWhat it isOpen source?Best fit
dbt Semantic Layer (MetricFlow)A metrics layer on top of dbt models, defined in YAML in the dbt project. MetricFlow compiles metric requests into SQL.Partly. MetricFlow is Apache 2.0 and can define and query metrics locally. Serving them to BI tools through the hosted dbt Semantic Layer APIs needs a dbt Starter or Enterprise-tier account.Teams that already model in dbt and want metrics versioned next to the models, then served to BI tools and spreadsheets.
CubeA universal semantic layer with SQL, REST and GraphQL APIs and pre-aggregations, now positioned as an agentic analytics platform. Defined in YAML or JavaScript (cubes and views).Yes. Cube Core is open source; the Cube platform is the commercial product.Embedded analytics and custom data apps that need an API and a caching layer in front of the warehouse.
AtScaleA universal semantic layer for enterprise BI. Queries resolve against optimised aggregates. Defined in SML, a YAML-based language, with Git-based CI/CD.Partly. SML is open source. The AtScale platform is commercial.Large organisations serving Excel, Power BI and Tableau from one governed model.
Looker (LookML)A BI platform whose models are written in LookML files, usually kept in a Git repository. Looker generates the SQL from the model.No. Looker is a Google Cloud product.Companies standardised on Looker. Its Open SQL Interface exposes models to other tools over JDBC.
Databricks Unity Catalog metric viewsMetrics defined as governed objects in Unity Catalog and queried with MEASURE(). Defined in YAML, created with SQL DDL or the Catalog Explorer UI.A Databricks platform feature (Databricks Runtime 16.4 and above).Databricks-centric stacks: usable from SQL, notebooks, dashboards, Genie, alerts and external BI tools.
Snowflake semantic viewsA schema-level object storing logical tables, relationships, facts, dimensions and metrics. Created with SQL (CREATE SEMANTIC VIEW) or in the Snowsight UI.No. A Snowflake platform feature.Snowflake-centric stacks that use Cortex Analyst and Cortex Agents.
MitzuA semantic layer for product analytics (events, properties, entities, sampled values) with a deterministic query engine for funnels, retention, segmentation and journeys. Built by the Configuration Agent from your warehouse, then edited in the app.No. Commercial, with self-hosting available.Product, growth and marketing questions on event data already in a warehouse. Not a general metrics layer for BI tools.

The last column is the short answer. If your transformations are in dbt, start there. If the consumer is software, look at Cube. If one BI tool or data platform serves nearly everyone, its native layer is the least work.

If you need a finance metric in Tableau, Mitzu is the wrong tool; if you need a five-step funnel or a retention curve, a metrics layer is the wrong shape.

Open source semantic layer options

Two of the engines are open source. MetricFlow is distributed under the Apache 2.0 license, and Cube Core has an Apache 2.0 backend and an MIT-licensed client. AtScale has open-sourced its modelling language, SML, while its platform is a commercial product. There is also a shared format in progress: Apache Ossie (incubating), formerly the Open Semantic Interchange, defines a JSON and YAML specification for exchanging semantic models between tools, and dbt documents that MetricFlow works with it.

The semantic layer for AI: grounding LLMs and agents

An LLM pointed at a raw warehouse is a new analyst on day one with nobody to ask. It sees amount, status and cust_id, and it guesses. Snowflake measured this on its own evaluation set: single-prompt GPT-4o text-to-SQL reached 51% accuracy, while Cortex Analyst, which pairs an agentic system with a semantic model, reported more than 90% (Snowflake Engineering). That is a vendor benchmark, but every tool in the table above now grounds its AI the same way. Looker's Conversational Analytics is grounded in LookML, and Databricks adds synonyms to metric views so Genie can find the right measure.

A semantic layer gives an LLM or agent three things:

  • Vocabulary. Named, described metrics and dimensions, so sales, revenue and turnover resolve to the same object.
  • Safe paths. Declared joins and cardinalities, so the model does not invent a join that double counts.
  • A narrower task. Choosing a metric and three dimensions from a catalogue is far easier than writing a correct 40-line query.

Two designs: the model writes SQL, or the model fills in a request

In the first design, the LLM still writes SQL with the semantic layer as context, and can still get the query wrong in ways that run. In the second, the LLM never writes SQL. It produces a structured request (metric, dimensions, filters) and the layer's compiler generates the query, so the same request always yields the same SQL. Metrics layers such as dbt and Cube support this through their APIs, and dbt and AtScale expose their layers to agents through an MCP server. Analytics agents vs text-to-SQL compares the two designs in depth.

The limit of a metrics-shaped semantic layer

Grounding fixes vocabulary, not method. A metrics-and-dimensions layer answers questions of the form aggregate X by Y. Much of product analytics has a different form: an ordered sequence of events per user, a time window between steps, a cohort tracked week by week. Some metrics layers cover the simplest case: dbt has a conversion metric for one base event followed by one conversion event within a window. A five-step funnel with per-step drop-off, a retention curve or a path analysis is usually not a first-class object in that shape, so it becomes a hand-built SQL model or SQL the LLM improvises. That is where errors hide: steps out of order, no conversion window, a user counted twice, and a plausible number at the end. Why an analytics agent needs a semantic layer walks through this with annotated funnel SQL.

Mitzu's semantic layer for product analytics

Mitzu is an agentic product analytics platform that runs on your data warehouse, and its semantic layer is shaped for that job. Instead of metrics and dimensions, it stores events and their properties, entities (users and groups) with their dimension properties, and sampled filter values from the warehouse, so a filter on country uses a value that exists in your data. Saved insights and cohorts join the vocabulary over time.

Nobody writes it by hand. The Configuration Agent scans the warehouse, recognises event and dimension tables (Segment, Snowplow, GA4, Firebase and custom schemas), maps the user ID, timestamp and event name columns, and asks about ambiguous ones. An analyst reviews the result in the app, and indexing keeps it in sync as the data changes.

Mitzu then applies the second design to behavioural analysis. The Analytics Agent does not write SQL. It assembles an analysis specification: for a funnel, the first event, the following steps, the conversion window and the breakdowns; for retention, the cohort event, the return event and the time granularity. A deterministic query engine, the same one behind the no-code funnel and retention builders, turns the specification into SQL. The method lives in the engine, so the model cannot get it wrong, and every answer shows its SQL for review (how the agent works).

The two kinds of layer are complementary: finance metrics in dbt or metric views for BI, a product analytics layer for behavioural questions, both on the same warehouse tables. The Mitzu semantic layer page shows the product side.

Semantic layer implementation challenges

The technology is the easier half. Projects usually stall for one of these reasons.

  • Agreeing on definitions. Deciding what an active user is takes a negotiation between teams, and no tool settles it. Start with five metrics people already argue about, not five hundred.
  • Authoring and upkeep. Hand-written models go stale when the schema changes, and a stale layer produces confident wrong answers.
  • Coverage gaps. Whatever the layer cannot express, people compute outside it, and you have two sources of truth again.
  • More than one layer. A BI tool, a warehouse and a metrics tool can each hold definitions. Decide which is the source; interchange formats such as Apache Ossie are still young.
  • Performance and cost. Generated SQL runs on your warehouse, and wide joins over large fact tables get expensive. Several tools offer caching, pre-aggregation or materialisation for this.
  • Thin metadata. A layer built for dashboards often has field names and little else. LLMs need descriptions, synonyms and real example values to choose the right field.

FAQ

What is a semantic layer?

A semantic layer is a governed set of definitions between the raw tables in a data warehouse and the people, BI tools and AI agents that query them. It maps columns and joins to business terms such as revenue, customer and active user, and compiles requests for those terms into SQL, so each metric is defined once and returns the same number everywhere.

What is the function of the semantic layer in Databricks?

In Databricks, the semantic layer role is played by Unity Catalog semantics, whose core implementation is the metric view. A metric view separates measure definitions from the dimensions used to group and filter them, so a metric such as revenue per customer is defined once and grouped by any available field at query time. Metric views are written in YAML, queried with MEASURE(), and used by SQL editors, notebooks, dashboards, Genie and alerts.

What is a semantic model example?

A semantic model example is an orders table described in business terms: order and customer as entities, order date and sales channel as dimensions, and net revenue as a metric defined as the sum of amount minus refunds for completed orders. A request for net revenue by month and country then compiles to SQL that joins orders to customers and groups by both. The full YAML and SQL are in the example above.

What are the best semantic layer tools?

There is no single best one. The main semantic layer tools are dbt Semantic Layer (MetricFlow), Cube, AtScale, Looker with LookML, Databricks Unity Catalog metric views and Snowflake semantic views. dbt fits teams that already model in dbt, Cube fits embedded analytics and data apps, AtScale fits enterprise BI on Excel and Power BI, and the platform-native options fit stacks built on one warehouse. For funnels and retention, Mitzu provides a semantic layer built for event data.

Key Takeaways

  • A semantic layer stores definitions, not data: entities, dimensions, metrics, joins and access rules that compile to SQL on your warehouse.
  • There are four practical types: BI-tool, universal (headless), warehouse-native and domain-specific. Many companies run more than one.
  • MetricFlow (dbt) and Cube Core are open-source engines and AtScale's SML is an open-source modelling language. LookML, Databricks metric views and Snowflake semantic views are platform features.
  • Grounding an LLM in a semantic layer stops it inventing column meanings. A metrics-and-dimensions layer does not teach it how a funnel or a retention cohort must be computed.
  • Mitzu's semantic layer is built for product analytics: events, properties, entities and sampled values, with a deterministic engine that writes the SQL instead of the model.

About the Author

István Mészáros

Co-founder & CEO

LinkedIn: https://www.linkedin.com/in/imeszaros/

Co-founder and CEO of Mitzu. Passionate about product analytics and helping companies make data-driven decisions.

Share this article

Subscribe to our newsletter

Get the latest insights on product analytics.

Ready to transform your analytics?

See how Mitzu can help you gain deeper insights from your product data.

Get Started

How to get started with Mitzu

Start analyzing your product data in three simple steps

Connect your data warehouse

Securely connect Mitzu to your existing data warehouse in minutes.

Define your events

Map your product events and user properties with our intuitive interface.

Start analyzing

Create funnels, retention charts, and user journeys without writing SQL.