Data Modeling Best Practices

Chapter 2 · Practice 2 of 4

Know which measures can be summed, and store the parts of ratios

From Fact tables

Why it matters

Microsoft's guidance groups measures by how they aggregate:

  • Additive: can be summed across every dimension, like quantity or revenue in one currency.
  • Semi-additive: can be summed across some dimensions but not others. Stock balances sum across products on one day, but not across days. Revenue with a currency key cannot be summed across currencies.
  • Non-additive: cannot be summed at all, like unit prices, temperatures, rates and ratios.

The practical rule: store the components, not the ratio. Keep discount_amount and gross_amount and compute the discount rate at query time, instead of storing discount_pct that someone will eventually sum or average incorrectly.

Do

  • Document the additivity of every measure in its column description

Avoid

  • Storing percentages that downstream users will average across rows