Skip to content
Tech Interview Prep
Technical interview guide

Semantic Data Modeling for BI

The metrics layer that defines business terms consistently, so 'revenue' means the same thing in every report.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Current dbt MetricFlow, LookML, Power BI, Tableau, Cube, OpenMetadata, BigQuery, and Snowflake guidance reviewed 2026-09-04.

Overview

Curated: · Written: · Reviewed:

Semantic Data Modeling for BI

In one line

A semantic layer compiles each business metric (revenue, conversion, active subscribers) from one governed definition with declared grain, keys, time basis, exclusions and access rules, so every dashboard, notebook and agent gets the same scoped number. Reach for it when the same name is being computed differently in more than one place.

Key definitions

  • Grain: what one row of a fact table represents. Declare it before designing the table and test that it holds.
  • Fan-out: a join between facts at different grains repeats one side's values, so totals inflate.
  • Additivity: fully additive measures sum everywhere; semi-additive ones (balances, inventory) do not sum across time; non-additive ones (ratios, distinct counts) must be recomputed from numerator and denominator.
  • Conformed dimension: one agreed key, hierarchy and change behaviour shared by several facts.
  • Time basis: the timestamp that stamps a fact (event, booking, settlement, ingestion). Choose it per metric.
  • As-of join: a join to a type-2 dimension that filters on validity dates, not just the natural key.

Formulas and complexity

conversion=∑orders∑sessions\text{conversion} = \frac{\sum \text{orders}}{\sum \text{sessions}}

Pooled across segments. The average of segment rates is wrong.

RSE≈1.04m\text{RSE} \approx \frac{1.04}{\sqrt{m}}

For HyperLogLog with m registers. Storage per sketch is m times 6 bits. For 200 countries over 90 days, m = 16384 gives about 0.81% error and about 221 MB, which fits the 250 MB limit. m = 8192 gives about 1.15% and fails.

How it works

The metric is declared once with its formula, grain, population, exclusions, time basis and access rule. A consumer requests the metric by name and dimensions. The layer compiles SQL that joins facts only through conformed dimensions, applies row-level security at a trusted boundary, and either serves a pre-aggregation whose grain, filters and currency match or queries the base facts.

yes no Metric request Certified definition Compile SQL Security filter Aggregate matches grain and scope Pre-aggregation Base facts Cache keyed by tenant metric version currency

When to use and when not to

SituationUse a semantic layerKeep the logic in the BI tool
Same metric read by several tools or agentsYesNo
One team, one dashboard, exploratoryNoYes
Metric feeds a board deck or contractYes, with owner and versionNo
Definition still changing weeklyOnly as a versioned draftAcceptable
Needs row or column security across consumersYes, enforced at query boundaryDashboard-only filters are insufficient

Traps interviewers probe

  1. Joining facts at different grains. Joining order headers to shipments multiplies revenue per shipment. Fix: aggregate each fact to the shared grain first, or keep them in separate tables joined through conformed dimensions.
  2. Summing ratios or semi-additive measures. Averaging segment conversion rates or summing inventory across days gives wrong totals. Fix: store numerator and denominator and recompute; use end-of-period or average for balances.
  3. Joining slowly changing dimensions on the natural key alone. Both rows of a type-2 dimension match, so each fact counts twice. Fix: join on the surrogate key or add an as-of predicate on validity dates.
  4. Ignoring NULL in filters. A predicate like is_refunded = false drops NULL rows silently. Fix: state the NULL semantics in the contract and test them.
  5. Caching without the full scope. Keys that omit tenant, metric version or currency return another caller's or another definition's result. Fix: include all of them in the key, or partition the cache.

Interview tips

Open with the contract: "A semantic layer owns definition and access. The warehouse owns storage and keys. The BI tool owns presentation." Then name the contract fields that matter for the question.

Expect these follow-ups:

  • Two dashboards differ by 3%: diff grain, population, time basis, currency and version before reading SQL.
  • Late corrections: version the change and keep the closed period's value reproducible.
  • Late dimension members: load facts to an unknown-member key so reconciliation ties out, then reassign when the real row arrives.
  • Role-playing dates: create one alias per role from a single calendar table.
  • Competing definitions: rename to distinct certified metrics and migrate consumers under the owner's decision.
  • Natural-language queries: resolve to certified metrics only, and reject requests whose grain the metric does not support.

30-second outline: definition in one sentence; the grain and time basis; the join path that prevents fan-out; the security and cache scope; one test that would catch the failure.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.