What Are Databricks Metric Views?
A metric view is a Unity Catalog object that describes metrics in business terms: the source table or joins, the dimensions people slice by and the measures that calculate the numbers. Databricks positions metric views as the core of business semantics in Unity Catalog. You define one in YAML, through SQL or the Catalog Explorer.
Because a metric view is registered in Unity Catalog, it's governed and discoverable like any other catalog object. The same definition can be used in AI/BI dashboards, Genie Agents, SQL queries and notebooks, instead of being rebuilt in each tool.
How Metric Views Work
- Source. A table, view or SQL query the metric view reads from, plus optional joins to related tables.
- Dimensions. The attributes people group and filter by, such as company, region, customer or fiscal period.
- Measures. Named aggregations, such as total revenue or gross margin percent, written once with their business rules.
A short YAML definition with a source, two dimensions and one ratio measure looks like this:
version: 0.1
source: finance.gold.sales_lines
dimensions:
- name: fiscal_period
expr: fiscal_period
- name: company
expr: company_name
measures:
- name: gross_margin_pct
expr: (SUM(net_sales) - SUM(cost_of_sales)) / SUM(net_sales)Queries call measures with the MEASURE() function and group by any dimension the metric view exposes:
SELECT fiscal_period, company,
MEASURE(gross_margin_pct)
FROM finance.metrics.sales_metrics
GROUP BY fiscal_period, company;Metric Views vs Standard and Materialized Views
A standard SQL view fixes its grouping when it's written. A materialized view stores the result of a query for speed. A metric view separates the measure definitions from the dimensions, so a ratio such as margin percent is recalculated correctly at whatever level someone asks for, instead of being averaged from rows that were already grouped. That's the difference that matters for finance questions.
Metric Views and Databricks Genie
A Genie Agent (formerly called a Genie space) can use metric views as data sources. When it does, Genie answers natural-language questions by choosing defined measures instead of writing its own aggregations over raw columns. Metric views give Genie the business definitions, and Genie gives business users a way to ask questions of them in plain language.
Metric Views vs a Power BI Semantic Model
Both define business meaning for analytics and AI. A Power BI semantic model holds measures in DAX for Power BI, Fabric and the Microsoft AI tools. Metric views hold measures in Unity Catalog for Databricks tools. The format differs. The business logic, such as which order types count and how currencies convert, should be the same in both.
Frequently Asked Questions
What is a metric view in Databricks?
A metric view is a Unity Catalog object that defines measures, dimensions and source joins once, so dashboards, SQL, notebooks and Genie Agents all use the same metric definitions.
How do you query a Databricks metric view?
With SQL, using the MEASURE() function for each measure and a GROUP BY on the dimensions you want. Dashboards and Genie Agents can also use metric views directly.
Are metric views the same as a semantic layer?
Metric views are Databricks' way of building a semantic layer inside Unity Catalog. They cover the metric definitions. Descriptions and Genie Agent instructions add the rest of the context AI tools use.
How do you create a metric view in Databricks?
Write a YAML definition that names the source, the dimensions and the measures, then create it with SQL or in Catalog Explorer, which validates the YAML. Once it's registered in Unity Catalog, it's governed and discoverable like any other catalog object, and dashboards, SQL and Genie Agents can query it.
Metric Views and QuickLaunch's Approach
Every QuickLaunch Application Pack is available on Databricks. For JD Edwards, the business logic is built as Unity Catalog metric views, along with Databricks dashboards, so Databricks Genie answers from the same definitions as your reports. For Vista, Spectrum, NetSuite, OneStream and Salesforce, the same definitions can live as Unity Catalog metric views. See our Databricks page and the Databricks vs Microsoft Fabric comparison.
More plain-English definitions of data, analytics and AI terms are in the QuickLaunch Learning Center.