Databricks Metric Views

Databricks metric views are Unity Catalog objects that define business metrics once, with their measures, dimensions and source joins, so dashboards, SQL, notebooks and Genie use the same definition.

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.

About the Author

Avatar photo

Louie Benitez

Louie learned the product the practical way, by deploying it. After years on the implementation team getting customers live, he moved into sales engineering, where he now demos and scopes the solution for prospects. He writes from the delivery seat about what a real rollout looks like and where ERP data tends to break.

Related QuickLaunch Solutions and Products

Foundation Pack

Accelerate time to insight while lowering total cost of ownership by creating a unified and centralized business foundation with your CRM, ERP, and other data sources.

Key Features

  • Automated Data Pipelines
  • Governed Data Lakehouse
  • Enterprise Semantic Layer
  • Kept current through upgrades
Learn More About the Foundation Pack

JDE Pack

Finance, supply chain, manufacturing, job cost and payroll analytics for JD Edwards EnterpriseOne, with the business logic built and validated.

Key Features

  • 35 perspectives
  • 3,900+ measures
  • Income statement and balance sheet hierarchies
  • Automatic Julian date conversion
  • User-defined code translation 
Learn More About JD Edwards Analytics

Get Your Custom Analytics Blueprint

See the ideas working in a live demo. We'll show the semantic model, the governed lakehouse and AI answers for JD Edwards, Vista, NetSuite, OneStream, Salesforce or Spectrum.

Get Custom Demo