Analysing and serving · Chapter 12
Databricks metric views and Power BI: where definitions live
Reviewed by TechFabric engineers. How we write this guide →
A Databricks metric view is a Unity Catalog object that defines business measures (net revenue, active customers) and the fields they can be grouped by, once, in YAML, so every dashboard, SQL query, Genie Agent and BI tool computes them the same way. You query one with MEASURE(), it's governed and traced in lineage like a table, and it's the semantic layer we'd use on Databricks instead of measures locked inside a BI model.
This chapter covers writing and querying metric views, connecting Power BI to them (which changed in October 2026), and the dashboard habits that keep reporting cheap, with one first-hand story about what a badly shaped dashboard costs. Facts are as of 22 October 2026.
The short version
Reporting is not really a charting problem, it is a definitions problem. When revenue, active customer and churn are defined inside a BI tool, only that tool understands them, and everyone else reinvents the calculation slightly differently. Databricks puts those definitions in Unity Catalog as metric views, where dashboards, SQL analysts, notebooks and AI agents all read the same thing and lineage runs back to source. If you already run Power BI, keep it. It draws better charts than we need to argue about, and the connector is good. What we would change is which layer owns the logic, how the data is accessed, and where row-level security is enforced. If you are starting fresh with no BI investment to protect, we would not buy a BI tool at all.
What is a metric view, and how do you write one? #
Unity Catalog Business Semantics has two parts. Metric views hold the structured definitions, meaning the measures and dimensions that make up a business concept, expressed in SQL. Agent metadata holds the contextual knowledge AI agents need to interpret a question the way a person in that department would interpret it.
A metric view is a few lines of YAML wrapped in SQL DDL. This is the shape from Databricks' metric view documentation, cut down to one measure:
CREATE OR REPLACE VIEW main.finance.orders_metrics
WITH METRICS LANGUAGE YAML AS $$
version: 1.1
source: main.sales.orders
fields:
- name: Order Month
expr: DATE_TRUNC('MONTH', order_date)
- name: Region
expr: region
measures:
- name: Net Revenue
expr: SUM(amount) - SUM(refund_amount)
$$;
SELECT `Region`, `Order Month`, MEASURE(`Net Revenue`)
FROM main.finance.orders_metrics
GROUP BY ALL;The YAML 1.1 spec groups dimensions under fields:; the low-code editor in Catalog Explorer writes the same thing as dimensions:, so don't be thrown when the two disagree. Metric views arrived in Databricks Runtime 16.4, but the runtime that matters is set feature by feature, and the create page (updated 12 October 2026) asks for a SQL warehouse or compute on 17.3 or above. From the feature availability table (updated 13 October 2026):
| Runtime | Feature |
|---|---|
| 17.3 | Materialization, snowflake schemas, agent metadata (comments, synonyms, display names), TEMPORARY metric views, JDBC and ODBC through the Thrift server |
| 18.0 | BI compatibility mode, REFRESH MATERIALIZED VIEW |
| 18.1 | One-to-many joins, window measure offset, rely.at_most_one_match join optimisation |
| 18.2 | Parameters, wildcard expressions for fields and measures |
Before moving a measure, we'd check that every job and BI connection that reads the view runs at least the runtime of the newest feature it uses. A SQL warehouse is always on the latest version, so the gap shows up on classic job clusters pinned to an older LTS.
The query side is where analysts trip (querying metric views). Every measure must be wrapped in MEASURE(), SELECT * doesn't work, and you list the fields you group by. Filters on fields go in WHERE as usual, and the engine works out the aggregation, so a revenue figure filtered to one region is still computed from the measure's definition rather than from whatever SUM the analyst would have written.
The important property of a metric view is where it lives rather than what it does. It sits in Unity Catalog, inherits the same governance as the tables under it, appears in lineage, and can be queried by any engine or tool that speaks SQL. A LookML model can only be read by Looker, and a DAX model can only be read by Power BI. Both are perfectly good pieces of engineering, and both make the definition invisible to everyone standing outside the tool.
That invisibility is the cause we'd look for first behind three familiar symptoms. Dashboard sprawl happens because a team can't find or reuse an existing definition, so they build their own. AI answers are wrong because the model has the tables but not the meaning. Two directors disagree in a meeting because two tools computed the same word differently and neither is wrong within its own boundary.
What you get when the definitions move #
AI/BI Dashboards run in place on the lakehouse rather than over an extract, using Unity Catalog for access control, lineage and metadata. When a dashboard reads metric views, its definitions stay consistent with everything else that reads them, and a materialized metric view lets common measures come from a precomputed aggregate the engine rewrites the query to use. Databricks also markets AI/BI without per-user licence limits, which matters more than it first appears and which we return to below.
Genie Agents (formerly Genie spaces) are the conversational side of the same foundation, and a metric view gives one a structured definition of "revenue" instead of a guess from column names. We'd expect the difference between a Genie Agent people trust and one they abandon to come from that curation far more than from the model behind it, which is the argument Genie makes at length, with how to build and test one.
The five pillars of modern analytics, and where we would push #
Databricks frames all of this as five pillars of modern analytics: a governed lakehouse foundation, Lakeflow for ingestion and transformation, unified semantics through metric views, AI/BI Dashboards, and Genie for questions in plain language. We'd use it as a map in an architecture review, because the order is right. Each pillar depends on the ones before it, and a team that buys the dashboards before doing the semantics gets prettier disagreement. The working chapters are Unity Catalog and Tables and Storage for the first pillar, Medallion Architecture and Real-Time and Change Data Capture for the second, this chapter for the third and fourth, and Genie for the fifth.
There are three places we'd push on it. Pillar five is where the risk lives: a conversational interface over governed data will answer confidently about data it doesn't have, so we wouldn't put Genie in front of a business audience without a fixed set of questions with known answers, run as a test suite whenever the tables change. The framework is also about analytics, which is the easier half, since reading data and showing it to a person is lower risk than acting on it, and that second half is Governed Actions. And "BI is broken because it wasn't designed for AI" is half the story. BI was broken for people too, because definitions lived in tools rather than in the platform, and we'd make the case for metric views on that ground, since it doesn't need the reader to care about AI to hold.
What's specific to Databricks is that all five land inside one governance boundary. On AWS, Azure and Google Cloud the same five jobs are four or more products, each with its own permission model to keep in step by hand, and the semantic layer is either missing or belongs to the BI tool, which is the exact failure the third pillar names.
Dashboard discipline #
A dashboard should read gold tables and metric views and contain no business logic of its own. The moment a widget carries its own SQL, you have created a calculation with no review, no test and no lineage, sitting in a place nobody thinks to look during an audit.
Dashboards also cost money when nobody is watching. A scheduled refresh runs whether or not the audience still exists, so a dashboard can go on refreshing hourly for an owner who left long ago. Query history is available as the system.query.history table, with the dashboard behind each statement in query_source.dashboard_id, so finding dashboards nobody has opened in a quarter is a query rather than a project. We'd run that review every quarter and retire aggressively, because an unopened dashboard costs compute now and costs credibility later when somebody finally opens it.
Two queries cover most of that review. The first lists the dashboards that still run queries and when anyone last ran one by hand, separating scheduled refreshes from people (we'd treat a dashboard whose only executor in ninety days is its schedule's identity as a retirement candidate):
SELECT query_source.dashboard_id AS dashboard_id,
COUNT(*) AS statements,
COUNT(DISTINCT executed_by) AS executors,
MAX(start_time) AS last_run,
ROUND(SUM(total_duration_ms) / 3600000, 1) AS hours_of_query_time,
ROUND(AVG(CASE WHEN from_result_cache THEN 1 ELSE 0 END), 2) AS cache_hit_share
FROM system.query.history
WHERE query_source.dashboard_id IS NOT NULL
AND start_time >= current_date() - INTERVAL 90 DAYS
GROUP BY ALL
ORDER BY hours_of_query_time DESC;The second looks for the pattern in the field story below, the same base query sent several times per open. Grouping a dashboard's statements by their text within each minute shows a board firing near-identical SQL in bursts, which is one dataset per widget group where one row-level dataset would do. statement_text reads as <REDACTED> unless you're an account admin or in the databricks_pii_access group (query history table), so this one belongs to whoever owns the platform review:
SELECT query_source.dashboard_id AS dashboard_id,
date_trunc('MINUTE', start_time) AS minute,
sha2(statement_text, 256) AS statement_hash,
COUNT(*) AS repeats
FROM system.query.history
WHERE query_source.dashboard_id IS NOT NULL
AND start_time >= current_date() - INTERVAL 7 DAYS
GROUP BY ALL
HAVING COUNT(*) > 1
ORDER BY repeats DESC;The cache-hit share in the first query is the number we'd watch after any consolidation. A well shaped board reuses its results across viewers, and a share that stays near zero on a busy dashboard usually means every load is computing from scratch, because the datasets differ by a filter value or a timestamp.
Dataset materialization, in Beta since 7 October 2026, is the other lever: a published dashboard stores each dataset's result on its refresh schedule and renders from it, instead of querying on every load (dashboard materialization). The limits decide where it fits. It needs a dashboard published with shared data permissions and a warehouse on 17.3 or above, parameterized datasets can't be materialized, and data behind row filters, column masks or ABAC policies can't be either; if a row filter is added to a source table later, queries quietly bypass the stored result and hit the source again. So it suits a board everyone sees the same way, and does nothing for one whose point is that each viewer sees their own rows. Refreshes run on serverless pipelines and the stored results bill as storage.
From the field: one dataset per dashboard #
Andrey Taran, Senior Databricks Engineer at TechFabric, built the first AI/BI dashboards for a client's embedded reporting the fast way. The client sent Power BI examples, the team rebuilt them with AI help, and each group of widgets got its own pre-aggregated SQL. That put real data in front of the client and got the approach approved. Then they read the query history, and it showed the same base query running several times per board. An AI/BI dashboard runs each dataset as its own query, and a filter change re-runs every dataset bound to it, so five datasets meant five copies of the base query against the application's database on every open and every filter click. In the window they measured, one dashboard fired 285 queries.
The rule they use now is one row-level dataset per dashboard, with the aggregation in the widgets. The dataset returns rows plus a few derived columns, counters, bars, lines and pies compute their own SUM and AVG through the widget encoding, and the filters bind to that one dataset, so the base query runs once per load and once per filter change. The rule has three costs. A pivot table can't filter a shared dataset to one subset of metric rows, so each pivot keeps its own pre-aggregated query. A counter accepts only a simple aggregate of a column, so a percentage has to arrive as a derived column in the dataset. And widgets inline the dataset SQL onto one line, so a -- comment turns the rest of the query into a comment, which is why their datasets use /* */ or no comments at all. The five client reports became pages of one dashboard as well, so switching between them stopped reloading everything.
The rule depends on what sits underneath. Over Lakehouse Federation an aggregated dataset pushed its GROUP BY down to Azure SQL and returned in about 5 seconds, while a raw-row dataset didn't push down and took about 50, so the KPI counters kept a pre-aggregated dataset of their own until the data moved to Delta. Then they folded back into the row-level dataset and started cross-filtering with the charts. The combined board still has 18 datasets, 15 of them bound to the filters, because pivots and per-dimension top-ten tables can't share rows, and when they run together a dataset query takes 1.4 times as long at the median as the same query alone, and up to three times as long. Andrey's part 2 has the measurements.
The Power BI question #
The argument is often made badly, so start with what Power BI does well. It's an excellent visualisation tool with a mature set of add-ons, a large trained user base, and a Databricks connector that works well. AI/BI doesn't draw better charts, and a working reporting estate is no reason to rebuild anything to prove a point about architecture. The argument is about four specific things.
The first is visibility. Business logic written in DAX inside a Power BI model cannot be read by a SQL analyst, a data scientist or an AI agent, and it cannot be traced in lineage back to the source columns it depends on. Move those definitions into metric views and Power BI continues to work exactly as before, except that it now reads governed definitions rather than owning them privately.
The second is copies. Import mode creates a second copy of the data with its own refresh schedule and its own security model, which is precisely the divergence the platform exists to remove. DirectQuery against a SQL warehouse keeps one copy of the data and one set of numbers.
The third is security. Row-level security defined in the platform applies to every consumer, including the notebook, the API and the agent. Row-level security defined in Power BI applies to Power BI, so anybody who reaches the data another way is outside it.
The fourth is licensing, and it's the one that's most uncomfortable once a team thinks it through. Per-seat pricing quietly shapes who is allowed to see data, which means a commercial model is making a governance decision that ought to belong to the business.
Reporting tools, judged on where the logic lives
| Capability | Databricks | Power BI | Tableau | Looker |
|---|---|---|---|---|
| Semantic layer location | Metric views in Unity Catalog | DAX model inside the tool | Tableau data source or published model | LookML inside Looker |
| Readable by other engines | Any SQL client | No | No | Semi, via the API |
| Lineage back to source columns | Automatic | Not beyond the connector | Not beyond the connector | Not beyond the connector |
| Governance model | Unity Catalog grants | Workspace roles plus dataset RLS | Site and project permissions | Looker model permissions |
| Default access pattern | Live on the lakehouse | Import extract, or DirectQuery | Extract, or live connection | Live SQL generation |
| Charting depth and add-ons | Good and improving | Excellent, very broad | Excellent, strongest exploration | Good, developer oriented |
| Licensing shape | No per-user licence limits | Per seat, plus capacity | Per seat | Per seat, platform pricing |
| Natural language over the model | Genie, grounded in the catalog | Copilot, over the tool model | Tableau Pulse and Ask Data | Conversational analytics |
Read that table honestly and Power BI wins two rows outright. Our position is that the rows it wins are presentation rows and the rows it loses are architecture rows, and presentation is easier to change later than architecture is.
How do you connect Power BI to Databricks metric views? #
Two things changed in October 2026. The Arrow Database Connectivity (ADBC) driver went GA on 15 October and is now the default for new connections in Power BI Desktop (2.145.1105.0 or later) and the Power BI service; existing connections stay on ODBC until you set Implementation="2.0" in the connection function in the Advanced Editor (ADBC for Power BI). And the "Metric View BI Compatibility Mode" option has gone from the Power BI connector, so reports built on it no longer work (metric views in BI tools, updated 16 October 2026).
What works now is the connector's native query option in DirectQuery mode, with the MEASURE() pattern written out:
SELECT `Region`, `Order Month`, MEASURE(`Net Revenue`) AS net_revenue
FROM main.finance.orders_metrics
GROUP BY ALLPower BI then treats the result like any DirectQuery table, and the definition of net revenue stays in Unity Catalog. Tableau users can do the same with Custom SQL, or switch BI compatibility mode on from the connection's Initial SQL. Excel goes through ODBC, and the same rule applies there: give finance a saved query that uses MEASURE(), because a pivot table summing raw columns rebuilds exactly the private definition you just retired.
The first month, if you run Power BI today #
This is the order we'd take it in, because each step is reversible and each one shrinks the next.
- Pull ninety days of
system.query.historygrouped byquery_source.dashboard_idand byclient_application, so you know which reports and which Power BI datasets actually run, and retire the rest before touching anything. - Pick the three measures people argue about in meetings, usually revenue, active customer and churn, and write each once as a metric view measure.
- Repoint the Power BI datasets that use those measures at a SQL warehouse in DirectQuery, reading the metric view through a native query (below), and compare the totals with the imported version for a full month-end before switching readers.
- Move row-level security for those datasets out of the Power BI model and into Unity Catalog, so the notebook, the API and the agent get the same answer as the report. DirectQuery alone isn't enough for this: without single sign-on every viewer's query runs as the publisher or a service principal, and a group filter evaluates against that one shared identity, so everyone sees its rows. Turn on "Report viewers can only access this data source with their own Power BI identities using Direct Query" in the dataset's data source credentials first, then prove it with a negative test (a viewer outside
finance-westopens the report and sees no western rows) before deleting the Power BI rules:
CREATE FUNCTION main.finance.region_filter(region STRING)
RETURN is_account_group_member('finance-all') OR is_account_group_member(concat('finance-', lower(region)));
ALTER TABLE main.sales.orders SET ROW FILTER main.finance.region_filter ON (region);- Only then decide which reports deserve a rebuild in AI/BI, and let usage make that call rather than a migration plan.
The test that it worked is a meeting where two directors bring numbers from two tools and the numbers match.
Beyond the basics #
The following matter mainly at the scale of hundreds of reports and multiple business units, where the failure modes are organisational rather than technical.
Certification, without the certification feature. Large Power BI estates use endorsed and certified datasets to tell users which model to trust. The equivalent with metric views is a naming and ownership convention plus catalog tags, where a certified metric view has a named owner, a test suite, and a tag that a search can filter on. We'd prefer this because the tag lives with the object rather than with the tool, so certification survives a change of BI vendor.
Managing hundreds of dashboards. We'd organise dashboards by domain rather than by team, give each domain a single owner accountable for retirement as well as creation, and require that a new dashboard names the metric views it reads. That last rule alone slows sprawl considerably, because it makes the reuse question unavoidable at creation time rather than at audit time.
Performance for reporting workloads. Three levers cover most of it. The result cache answers repeated identical queries without touching data, which is why a well shaped dashboard costs almost nothing on its second viewer. Materialised structures behind metric views turn a repeated aggregation into a computed one. Warehouse sizing should follow query shape, so a warehouse serving many small concurrent dashboard queries wants more clusters at a modest size, while one serving a few heavy analytical queries wants a larger size and less scaling.
Migrating a large estate incrementally. A big bang migration of a Power BI estate is the quickest way to lose organisational goodwill. The sequence we'd use starts with inventory and retirement, because any report with no current audience shouldn't be migrated at all, and the query history will show how many that is before anyone estimates the work.
Excel users are real. Finance runs on Excel, and pretending otherwise pushes the work into files nobody governs. A saved ODBC query over a metric view, as above, puts the governed definition in the workbook instead of a CSV somebody exported last Thursday. We'd treat a supported Excel path as a governance win rather than a compromise.
The semantic layer across the platforms
| Capability | Databricks | AWS | Azure | GCP |
|---|---|---|---|---|
| Where definitions live | Metric views in Unity Catalog | QuickSight datasets, or dbt on top | Power BI semantic models | LookML in Looker |
| Governed by the data platform | Yes | Partly, via Lake Formation | No, tool governs its own model | No, Looker governs its own model |
| Readable outside the BI tool | Yes, any SQL engine | Limited | No | Via the API only |
| Feeds AI agents the same definitions | Genie and agent metadata | Q, over its own datasets | Copilot, over the tool model | Conversational analytics |
| Row-level security reach | Every consumer of the table | Lake Formation plus tool rules | Tool rules for tool consumers | Looker rules for Looker users |
| User licensing model | No per-user licence limits | Per reader and author | Per seat plus capacity | Per seat |
The pattern in that table is the same one running through the whole manual. The other clouds each do the job well inside one product, and the gap only appears when a second consumer of the same definition turns up, which today is usually an AI agent.
Row-level security has a second, harder form when the audience is customers rather than employees, where each tenant must see only their own data and the reporting layer becomes part of the product. That is a different design problem with different failure modes, and it has its own chapter in Multi-Tenant and Per-User Reporting.
What's popular