← AI glossary

AI glossary · Advanced · Data engineering · AI platforms & solutions

Semantic layer

A semantic layer is an intermediate layer that defines in one place what business terms such as 'revenue' or 'active users' actually mean in the data and how they are calculated. Because dashboards, spreadsheets and AI all retrieve data through these definitions, the same question gets the same number.

About this term
Level
Advanced · Specialist terms that need the inner workings
Added
2026-10-09
In plain words It is similar to having one company-wide glossary and rulebook for calculations, and requiring every department to follow that rulebook when building reports. But a semantic layer goes beyond a document for people to read: it also generates and runs the actual queries according to those rules.

How it works

A data warehouse only has table and column names; it does not contain business rules such as 'net revenue is calculated excluding refunds.' A semantic layer defines these metrics, dimensions (date, region, etc.) and how tables are joined, in code or configuration files. When a user requests 'net revenue by region,' the semantic layer looks up the definitions, generates the appropriate SQL and sends it to the warehouse. The results are calculated the same way no matter where the request comes from, whether a BI dashboard, spreadsheet, API or AI agent.

How a question flows through a semantic layerBI dashboard → Semantic layer(Metric request); Spreadsheet → Semantic layer; AI agent → Semantic layer; Semantic layer → SQL generation; SQL generation → Data warehouse(Execution)BI dashboardSpreadsheetAI agentLLM·Text-to-SQLSemantic layerMetric, criteria andjoin definitionsSQL generationData warehouseMetric requestExecution
How a question flows through a semantic layer The tools on the left all go through the same definitions in the semantic layer in the middle to query the data warehouse. That is why the same number comes back no matter where you ask.

Why it matters

As organizations grow, it is common for each team to calculate 'revenue' slightly differently, so numbers do not match in meetings. A semantic layer reduces this confusion by gathering definitions in one place, and when a definition changes, it only needs to be fixed once. Recently it has drawn particular attention for Text-to-SQL, where LLMs ask questions of data. When an LLM interprets hundreds of tables directly, it easily makes wrong joins or incorrect calculations, but going through well-organized metric definitions makes answers much more stable.

Things to know

A semantic layer is harder to maintain than to build. If you do not decide who updates and approves changes when business definitions change, it quickly drifts away from reality. So it is often run together with data governance and a data catalog. Conceptually it has things in common with ontologies and knowledge graphs, but a semantic layer focuses mainly on 'calculating metrics consistently.'

Example

When an employee asks an internal data chatbot, "Tell me the number of new customers last month," the chatbot's LLM calls the 'new customer count' metric defined in the semantic layer instead of digging through tables directly. The number on the finance team's dashboard and the chatbot's answer are then calculated with the same definition, so they do not conflict.

Related terms