Semantic Integrity
Dimensional Grain: Preventing Apples-to-Oranges Comparisons
Grain defines the level of detail; without it, AI compares incompatible data.
Rendering diagram...
Aggregate lower grain data before comparison.
TL;DR
- • Grain must be explicit for facts and measures.
- • Incorrect grain leads to false comparisons.
The problem (layman)
- • Metrics are compared across tables with different levels of detail.
- • AI blends values that should never be compared.
Why it matters
- • Incorrect grain produces misleading insights.
- • AI explanations become unreliable.
Symptoms
- • Totals don’t reconcile across reports.
- • AI compares customer‑level metrics to order‑level metrics.
Root causes
- • Grain not documented in metadata.
- • Fact tables mixed in the same analysis without proper alignment.
What good looks like
- • Grain documented for each fact table and KPI.
- • Measures explicitly handle grain alignment.
How to fix (steps)
- • Document grain in table and measure descriptions.
- • Use bridge tables or aggregation logic to align grain.
- • Add tests that validate grain assumptions.
Pitfalls
- • Assuming the visualization implies the grain.
- • Mixing fact tables in measures without explicit joins.
Checklist
- • Fact table grain documented.
- • Measures specify grain assumptions.
- • Cross‑grain comparisons are controlled.