3 · Data modelling

7. Dimensional Modelling for Analytics

Facts, dimensions, star schemas, grain and slowly changing dimensions.

10 min read · 3 MCQs

Facts and dimensions

A fact table stores measurable events — one row per order line, payment or page view — with numeric measures and foreign keys. Dimensions describe the context: customer, product, date, channel. A star schema is one fact surrounded by dimensions and is deliberately denormalised for query speed and comprehension.

Grain first

Declare the grain — exactly what one fact row represents — before adding any column. Mixed grain is the root cause of double counting. Additive measures sum across all dimensions; semi-additive measures such as balances do not sum over time; non-additive ratios must be recomputed from components.

Slowly changing dimensions

Type 1 overwrites and loses history. Type 2 inserts a new row with validity dates and a current flag, preserving what the world looked like at event time. Type 2 is the default for anything used in historical reporting, such as customer segment or price tier.

Chapter quiz

3 questions · pass mark 75%
  1. 1. The grain of a fact table defines…

  2. 2. Type 2 SCD handles change by…

  3. 3. An account balance is which kind of measure?

Answer every question to submit. Progress for da-07 is saved in this browser.