Lakshya

Analytics & BI Tools · Chapter 12 of 18

The semantic layer, and who owns the metric

The real question behind most BI tool arguments, four architectures for answering it, and why the good answer usually fails for non-technical reasons.

8 min read1 diagramAll 18 chapters

Here is a scene that happens in every organisation above a certain size. Two people bring numbers for the same metric to the same meeting and the numbers differ. An hour is spent finding out why. The answer is that one report excluded internal transfers and the other did not, and both were correct according to whoever built them.

That is not a data quality problem and it is not a tool problem. It is a definition-ownership problem, and it is what the semantic layer exists to solve.

Four places the definition can live

“WHAT IS REVENUE?” — FOUR PLACES THE ANSWER CAN LIVE in every dashboard each report writes its own SQL or its own measure 400 dashboards, 400 definitions of revenue the meeting where two numbers disagree the default state of every self-service estate in the BI tool's model one shared model per tool governed, versioned, reusable works — until a second tool appears the notebook and the app cannot reach it good, and locked to one vendor in the warehouse views, or a transformation project SQL everyone can query every tool sees the same numbers cannot express context-dependent logic well the pragmatic majority answer in a semantic layer metrics defined once, queried by API dimensions, joins and grain declared BI, notebooks, apps and agents agree another system to run and to keep current the right answer at scale, if it is adopted Most tool arguments are really this argument. “Should we use Tableau or Power BI” is usually a proxy for “where does the definitionof revenue live?” And the failure mode of a semantic layer is not technical — it is that people route around it, because the fast path is still to writeyour own SQL.
The same question, four architectures. Note the last line — the failure mode of the best answer is social rather than technical.

In every dashboard. The default state. Each report author writes their own query or their own measure. It is fast to start, it scales to zero, and it produces the meeting described above. Every self-service estate arrives here without anyone deciding to.

In the BI tool's model. One shared, governed model that reports build on. This genuinely works, and it is the single highest-value governance move most organisations can make. Its limitation is that the definition is trapped in one vendor's model — a data scientist in a notebook, an application making an API call, or a second BI tool cannot reach it, so they reimplement it and you are back to disagreement across tools rather than within one.

In the warehouse. Definitions expressed as views or as a transformation project, so every tool that queries the warehouse sees the same numbers. This is the pragmatic majority answer and it is a good one. Its weakness is that SQL views express a fixed grain poorly — a metric that must be correct at daily, weekly and customer grain, and that involves a ratio or a distinct count, cannot simply be pre-aggregated, because those do not sum.

In a dedicated semantic layer. Metrics, dimensions, joins and grain are declared once, and consumers query the layer through an API which compiles the request into SQL. BI tools, notebooks, applications and increasingly AI agents all get the same answer, because there is only one place the answer is written.

Why the ratio problem is the technical crux

It is worth being precise about what a semantic layer does that a view cannot, because otherwise it sounds like ceremony.

Consider conversion rate = orders ÷ sessions. Pre-aggregate it by day and you cannot correctly roll it up to a week, because the average of seven daily ratios is not the weekly ratio. Pre-aggregate it by customer and you cannot get the company total.

The semantic layer stores the numerator and denominator as additive measures and computes the ratio at whatever grain is requested. The same applies to distinct counts, which never sum, and to anything involving a time window such as a rolling average or a period-over-period comparison.

So the layer is not a naming convention. It is the place where grain-correct aggregation logic lives, and that is a genuinely hard thing to distribute across four hundred dashboards written by different people.

The current architectures, and what interoperates

  • The BI-native model — a shared model inside the BI tool, consumed by reports built on it, and increasingly reachable over an API by other clients. The strongest option if you are genuinely single-vendor, and the weakest bet if you are not.
  • The code-first modelling language approach — definitions in version control, reviewed like code, compiled to SQL at query time. Its virtue is engineering discipline: pull requests, tests, a history of who changed the definition and why. Its cost is that changing a metric requires someone who can write the model, which is exactly the friction that makes people route around it.
  • The transformation-project semantic layer — metrics defined alongside the models that build the tables, queried through a server that compiles to warehouse SQL. The appeal is that it sits where the transformations already are, so the definition lives next to the data that produced it.
  • The standalone universal layer — a separate service that sits between any warehouse and any consumer, usually with aggregate awareness and caching built in. Most flexible, and one more system to operate.
  • The warehouse-native option — both major warehouse vendors have moved to offer semantic definitions inside the platform itself, which is a significant development because it removes the ‘another service to run’ objection entirely.

On interoperability, be sceptical of the marketing. Every one of these claims to be consumable by every BI tool. In practice the integration quality varies enormously — some connections are first-class and support drill-through and ad-hoc exploration properly, and others are a read-only bridge that returns a flat result set and loses most of the interactivity users expect. Test the specific pairing you intend to use, with a real analyst doing real work, before committing. That sentence is worth saying in an interview because it is what experience sounds like.

Why the good answer usually fails

The semantic layer's failure mode is not technical. It is that people route around it.

An analyst needs a number by Thursday. Getting it through the semantic layer means either learning the modelling language or waiting for someone who knows it. Writing the SQL themselves takes twenty minutes. They write the SQL, and a new definition of revenue enters the world.

This is a product problem, and the fix is a product fix: the governed path must be faster than the ungoverned one for the common case, not merely more correct. If querying the semantic layer is slower or harder than querying the table, governance will lose every time and no amount of policy will change that.

The practical implications: make the layer cover the top twenty metrics extremely well rather than every metric adequately. Make adding a metric take hours rather than a sprint. Give analysts a self-service path to propose a definition. And measure adoption — what proportion of queries go through the layer — because that number, not the number of metrics defined, tells you whether it is working.

This is the same lesson as internal platforms generally: a platform that is mandated rather than chosen is a platform nobody wanted.

What this changes about AI on top of analytics

There is one genuinely new reason this matters more in 2026 than it did in 2022. When a person asks a natural-language question of your data, something must translate that into a query. If it translates against raw tables, it will invent joins, pick the wrong grain and produce confidently wrong numbers — and the person asking has no way to tell.

If it translates against a semantic layer, it is choosing from declared metrics with declared grain and declared joins, which is a vastly smaller and better-constrained problem. The honest framing: a semantic layer is what turns natural-language analytics from a demo into something you would let a finance team use. That is currently the strongest business case for building one, and it is a better argument than metric consistency because it is about a capability rather than about tidiness.

Check yourself

What is the real question behind most BI tool arguments?Where the definition of a metric lives. 'Tableau or Power BI' is usually a proxy for 'who owns what revenue means'.
What can a semantic layer do that a SQL view cannot?Compute grain-correct aggregations for things that do not sum — ratios, distinct counts, windowed measures — by storing components and combining them at the requested grain.
Why do semantic layers fail?People route around them. If the governed path is slower than writing your own SQL, governance loses. The fix is to make the governed path faster, not to mandate it.
What should you measure to know whether it is working?The proportion of queries going through the layer, not the number of metrics defined.
← Tableau internals: the engine, and the order of operationsMaking a dashboard fast, and keeping it that way →