Home › Data engineering › Metric views

Data engineering · BI and analytics · free guide

Metric views, taught from zero

Ask three teams for "revenue last quarter" and you often get three numbers. Each team wrote its own SQL: one forgot returns, one counted cancelled orders, one joined a table that doubled rows. A semantic model fixes this by writing each business number once, with its recipe, and making every dashboard, spreadsheet and AI agent ask for the number by name.

This section teaches the idea first, with no product in it. Then it shows three products that build the idea, Databricks metric views, the dbt Semantic Layer and the Power BI semantic model, and where each falls short. Then it goes deep on metric views, and ends with one example built end to end.

The kitchengold tables:invoice lines, dealers,products, datesThe menu= the semantic model'Net revenue''Margin %''by region, by month'one recipe per dishDashboardGenie: questions in wordsExcel / Power BIAn AI agentcooks fromDiners order from the menu. Nobody walks into the kitchen and cooks their own revenue.

The semantic model is the menu between the kitchen (tables) and the diners (tools and people).

The short answer. On a Databricks lakehouse, write business numbers once as Unity Catalog metric views over atomic gold tables; keep row-level security on the gold tables, driven by one entitlements table; keep YAML in git with number tests; make every tool, Genie and agents included, read the metric views. Use dbt's Semantic Layer when metrics must travel across several warehouses, and keep Power BI models thin readers rather than a second home for the same logic.

The path

Ten pages, in this order

  1. 1 · The idea: What a semantic model is, before any product
    The semantic model with no product in it
  2. 2 · Three products: One idea, three products: metric views, dbt, Power BI
    How Unity Catalog metric views, the dbt Semantic Layer (MetricFlow) and the Power BI semantic model each build the ten parts of a semantic model, with the same metric written in all three, and where Cube, LookML, Snowflake semantic views and Apache Ossie fit.
  3. 3 · Limits: Limits of each, seen from eight seats
    The limits of metric views, the dbt Semantic Layer and the Power BI semantic model from the seat of the author, business user, BI tool, AI agent, security, performance, cost and change, with a Pursue/Drop verdict for common setups.
  4. 4 · Parts: The parts of a metric view
    Every part of a Unity Catalog metric view
  5. 5 · Grain: Grain, fan-out and the kinds of measure
    Granularity for metric views
  6. 6 · Row-level security: Row-level security with metric views
    Where row-level security lives for metric views
  7. 7 · Speed: Speed: materialization, pre-aggregation and layout
    How a metric view query runs and what makes it fast
  8. 8 · Production: Metric views in production: challenges, anti-patterns, best practices
    Running Unity Catalog metric views in production
  9. 9 · Example: One example end to end: tyre sales to dealers
    A complete worked example

Words used

A small glossary

Semantic model
A layer of business meaning on top of tables: which numbers exist, how each is calculated, how tables join, and how you may slice them. Also called a semantic layer or metrics layer.
Metric view
Databricks' product for a semantic model: a Unity Catalog object, written in YAML, that holds measures and dimensions and is queried with MEASURE().
Grain
What one row of a table means, such as one invoice line or one dealer per day.
Dimension (field)
A way to slice a number: region, month, product segment. Metric views call them fields.
Measure
An aggregation such as SUM(net_amount). It has no fixed grouping; the query decides it.
Composed measure
A measure built from other measures, such as margin = gross margin / net revenue.
Fan-out
When a join repeats rows, so sums come out too big.
Row-level security (RLS)
Rules that decide which rows each person sees.
Materialization
Pre-computed results that the engine reads instead of the raw tables when a query fits.
MetricFlow
dbt's open-source engine that turns a metric request into SQL.
DAX
Power BI's formula language for measures.

Related

Where it connects

The semantic layer (key concept) · Power BI vs Databricks AI/BI · Genie and metric views · Gold: shaped for the business · All data engineering

FAQ

Questions people ask

What is a Databricks metric view?

A Unity Catalog object that defines business measures and dimensions once, in YAML, over a source table and its joins. You query it with SELECT field, MEASURE(measure) ... GROUP BY ALL, and Unity Catalog turns that into SQL on the source tables.

Is a metric view the same as a normal view?

No. A normal view fixes the grouping when you create it. A metric view keeps measures unaggregated until query time, so the same measure can be grouped by any field the question needs.

Do I still need gold tables if I have metric views?

Yes. Metric views sit on top of clean, atomic gold tables. They hold the meaning and the recipes, not the data cleaning.

Sources

Checked against (11 Nov 2026)

Metric views change every few months. Confirm runtime minimums and preview status before a design depends on them.