Dimensional Modeling Overview
Facts, dimensions and the star that connects them
Dimensional modeling structures analytical data into facts (measures about events) and dimensions (context you slice by). It is the classic, proven shape for BI because it is intuitive, fast and flexible.
What you will learn
- Distinguish facts from dimensions by their role in a report
- Explain why dimensional shapes are fast for BI queries
- Recognize when a raw operational model won't serve analysis
What is this?
Dimensional modeling organizes a warehouse into facts — numeric measures about business events (one row per order, per sale) — and dimensions — the descriptive context you filter and group by (customer, date, product, region). Facts join dimensions through key-based relationships, typically in a star shape. It trades normalization for readability and speed, matching exactly how analysts think.
Why do you need it?
- Users reason in terms of 'sales by product by month' — dimensions ARE the slicing vocabulary.
- Star-shaped joins are cheap and explainable; dashboards read one fact plus a few dimensions directly.
- Modeling facts at atomic grain keeps every aggregation derivable without guessing.
- It is the default way BI tools and semantic layers are designed, so it integrates everywhere.
Mental model
A photo's subject and the scene around it
Facts and dimensions
The subject (a sale — the fact) is the measurement; the scene (who, when, where — the dimensions) gives the context that makes the measure meaningful. 'Sales of 5' means nothing; 'sales of 5, in March, to first-time customers in Spain' is a decision.
How it works
- A fact table holds the numeric measures and foreign keys to dimensions, at a declared grain.
- Dimension tables hold the descriptive attributes for one entity (customer, product, date).
- Surrogate keys (integer ids) join facts to dimensions; dimensions are denormalized for reading.
- Aggregations group by dimension attributes and sum/avg fact measures.
- The star schema is a fact hub with dimension spokes — the shape that makes SQL simple.
The star: one fact, many dimensions.
Examples
The shape of a dimensional read
SELECT d.month, c.region, SUM(f.sales_amount)FROM fact_sales fJOIN dim_customer c ON f.cust_key = c.cust_keyJOIN dim_date d ON f.date_key = d.date_keyWHERE d.month BETWEEN '2026-01' AND '2026-03'GROUP BY d.month, c.region;One fact, two dims, grouped by time and region. This is the workhorse query dimensional models are built to power.
In production
- A retail fact_sales table (grain: one transaction line) joins dim_date, dim_store, dim_product; daily dashboards group by any slicer.
- A fintech models fact_account_activity with dim_customer, dim_branch, dim_risk; regulatory reports read the same star with different filters.
- A subscription facts set (new, churned, retained) joins shared dim_customer and dim_date to drive the exec scorecard.
Best practices
- Start facts at atomic grain; aggregate to every coarser grain you need.
- Keep dimension attributes few but useful: attributes = the slicing vocabulary.
- Use surrogate keys everywhere; business keys (customer code) are volatile.
- Document grain and add uniqueness tests on (fact key, dim keys).
Common mistakes
- Building the dashboard from normalized source tables and re-deriving joins each time.
- Putting customer attributes in the fact table slice-of-time — that's a dimension's job.
- Over-modeling: 200 columns of unused attributes that slow everyone down.
- Skipping surrogate keys, so a renamed customer code breaks lineage.
Common issues
Report pasted over two regions double-counts shared customersCustomers appear in multiple region dims (row-level duplicates)
Make each customer one row with one region; use roles for multiple perspectives.
Renamed product code broke a year of historyBusiness key used as join key instead of surrogate
Add immutable surrogate keys and map business codes through a versioned dim.
Debugging tips
- If a group-by returns wrong totals, check fact grain first, then dimension key uniqueness.
- If dims use 'code' values with drift, migrate to surrogate keys and version the business key mapping.
- Validate one slice by hand: sum a small region's amounts and compare to source.
Interview checkpoint
Hands-on lab
- Split operational data into a fact and two dimensions
- Assign surrogate keys and join a star
- Answer three business questions from one star
Build Your First Star Schema
40 min · intermediate
Quick quiz
Which table holds 'month', 'region' and 'category'?
Dimensional modeling aims to fully normalize every table like a transactional schema.