Why AI analysts fail on bad metric definitions
AI can write valid SQL in seconds, but it can't know which definition of revenue your CFO approved. Why a governed metrics layer matters, with benchmark data.
Short answer: A semantic layer is a shared, written-down definition of your business metrics and how tables join. When an AI tool asks it for “revenue” instead of guessing at raw tables, it uses the same definition your dashboards use. Vendor benchmarks report large accuracy gains from this, though they are vendor benchmarks, so treat the exact figures with care.
Ask three colleagues what “active customer” means and you may get three answers. A person can usually work out which one you meant from context. An AI model cannot. It will pick one, write perfectly valid SQL, and give you a confident number that may not match anyone’s dashboard.
I wrote about that failure in why AI analysts fail on bad metric definitions. This post is the constructive half: what a semantic layer is and how to get the benefit without a giant project.
Think of it as a dictionary and a rulebook that sits between your raw tables and everyone who asks questions of them. It defines:
Common descriptions, such as Knowi’s, say the semantic layer centralises business logic so that every downstream consumer queries the same definition. The consumers can be a BI tool, a spreadsheet, a notebook or an AI assistant.
You may already have one without the name. A Power BI model with well-named measures is a semantic layer. So is a set of governed views in a warehouse.
When a model writes SQL against bare tables, it has to guess three things: which table holds the fact you want, how to join it, and what your company means by the metric. Guessing wrong produces a query that runs fine and answers a different question.
A semantic layer removes the guessing. The model doesn’t compose raw joins and aggregations. It asks for “revenue by month” and the layer supplies the agreed calculation.
There is evidence for this. dbt Labs published a 2026 benchmark comparing a semantic layer with text-to-SQL, and other write-ups such as Atlan’s discuss “metric drift”, where the same word gets calculated differently in different places. A caution I would apply to all of these: the companies publishing them sell semantic layers or related tools. The direction of the result makes sense to me, but I would not quote any single percentage as a promise for your data.
Tools differ, but the idea fits in a few lines. Here is a metric written in a generic, YAML-style form, for illustration only:
metric: revenue
description: Paid order value, net of refunds, in EUR.
calculation: SUM(orders.amount_eur) - SUM(refunds.amount_eur)
filters:
- orders.status = 'paid'
- customers.is_test = false
time_dimension: orders.order_date
dimensions: [customers.country, products.category]
Notice how much is decided: currency, refunds, test accounts, which date counts. Every one of those is a place where two analysts could otherwise disagree.
You don’t need a platform on day one. A workable first version:
If you use Power BI, model first, then calculation groups is the same discipline. A clean star schema is a semantic layer’s foundation.
My opinion: the definitions matter far more than the tool. A shared document that everyone respects beats a fancy platform that nobody maintains. If you are a team of one with three metrics, a note at the top of your SQL file is enough.
Sources: dbt Developer Blog: Semantic Layer vs. Text-to-SQL, 2026 Benchmark Update, Atlan: Text-to-SQL for Enterprise: Metric Drift and Context Layer, Knowi: Semantic Layer for AI. The YAML example is illustrative and not the syntax of any specific product.
Part of: AI for Analysts