Guide

The reporting layer: how to define metrics between your warehouse and your BI tool.

When two dashboards show different revenue, the cause is usually not the data but where the metric was defined: once in the warehouse, again in the BI tool and a third time in a spreadsheet. A reporting layer is the agreement about where that logic lives.

What a reporting layer is

The reporting layer is the set of tables, views or metric definitions that every report reads from. It sits after the warehouse models that clean and join source data, and before the dashboards, spreadsheets and exports people look at. Its job is to make sure a metric with one name has one definition.

It can be as simple as a handful of marts with documented columns, or as formal as a semantic layer that defines measures and dimensions in code and generates the SQL. For a small team the form matters less than the rule: business logic is defined once, below the BI tool, and reports only filter, group and display.

Decide where each kind of logic lives

Most metric drift happens because the same rule is written in several places. Assign each kind of logic to one layer and stick to it.

  • Warehouse models: cleaning, deduplication, joins, the grain of each table, and the business rules that decide which records count, such as excluding test and cancelled orders.
  • Reporting layer: the metric definitions themselves, the formula, the unit and how the metric may be aggregated, plus the dimensions it may be sliced by.
  • BI tool: filters, date ranges, groupings and presentation. A calculated field that redefines a metric in a single dashboard is a second definition waiting to disagree with the first.
  • Spreadsheets and exports: read from the reporting layer, never recalculated from raw data.

Define each metric once, in writing, before coding it

A metric definition answers the questions that cause disagreements later: who owns it, what it counts, what it excludes, at what grain it is calculated, in which time zone, and whether it can be summed across days or customers. Write those answers down and have the owner approve them before the SQL is written.

Ratios and distinct counts need special care. A conversion rate or average order value must be calculated from summed numerators and denominators at the reporting grain, not by averaging daily rates. Monthly unique customers cannot be summed from daily unique customers. Record which aggregations are valid as part of the definition.

Choose the form: marts or a semantic layer

Reporting marts are tables with metrics pre-calculated at a fixed grain, for example one row per day per channel. They are easy to understand and work with any BI tool, but every new grain or breakdown needs another table, and ratios must be recalculated correctly at each level.

A semantic layer defines measures and dimensions once, and generates the query for whatever grouping a report asks for. It removes duplicate marts and handles ratios consistently, at the cost of another tool to learn and integrate. Start with marts; move to a semantic layer when the number of marts serving the same metric becomes the maintenance problem.

Keep reports from drifting apart

Add tests on the reporting layer, not only on the models below it: keys unique at the stated grain, totals that reconcile with the fact table they came from, and no unexpected gaps in dates. When a definition changes, treat it like an API change: name the consumers, compare old and new figures for a past period, and announce the switch.

Review the reporting layer on a schedule. Metrics nobody has used for a quarter, and dashboards defining their own versions of governed metrics, are the first things to retire or fix.

Questions

Related questions

Is a reporting layer the same as a semantic layer?

A semantic layer is one way to build a reporting layer: metric definitions in code that generate queries. A set of well-documented reporting marts is another. Both serve the same purpose, one definition per metric that every report reads.

Should metrics be defined in the BI tool or the warehouse?

Below the BI tool, in the warehouse or a semantic layer, so that every dashboard, spreadsheet and export reads the same definition. The BI tool should filter and display, not redefine.

What should a metric definition include?

The name, the owner, the business question, the formula in plain words, the unit, the grain, the sources, who and what is included and excluded, the time zone and window, and which aggregations are valid. The free KPI definition template covers each of these.

Why do two dashboards show different numbers for the same metric?

Usually because the metric is defined in more than one place: different filters, a different time zone, a different date field, or a ratio averaged instead of recalculated. Reconcile the two queries step by step, then move the definition into the reporting layer.

The Divergence Point — monthly

Where the numbers stop agreeing, and what to do about it. One email a month on data quality, reconciliation and building warehouses that survive contact with a real business. No recycled LinkedIn posts.

Tell me what is broken.

A short call is usually enough to tell whether this is a two-week fix or a two-month one — and whether I am the right person for it.