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.