Fact Table Grain and Measurement Types
The grain defines what a row means; measure behavior defines how it can be summarized.
Fact table grain states exactly what one row represents. Every fact in that table must be valid at that grain. Measures also need aggregation rules so users do not sum values that should be averaged or selected at a point in time.
Declare the grain as a sentence
Examples include “one row per product per order line” or “one row per account per day-end snapshot.” Avoid vague declarations such as “sales data.” A precise grain helps determine keys, dimensions, valid measures and duplicate tests.
Understand measurement behavior
| Type | Example | Typical summary |
|---|---|---|
| Additive | Units sold on an order line | Can sum across many dimensions |
| Semi-additive | Account balance at day end | Can sum across accounts, not across time snapshots |
| Non-additive | Margin percentage | Recalculate from its numerator and denominator |
| Event or count | One row per shipment | Count rows if the grain and filters are appropriate |
Common grain errors
- Combining order-level totals with order-line rows and summing both.
- Mixing transaction facts with periodic snapshots in one table.
- Adding a dimension that changes the row identity without updating the declared grain.
- Using a ratio without preserving the underlying components.
Test the grain
Write a uniqueness test using the attributes that define a row. Compare row counts and totals with source processes. Test split lines, cancellations, corrections and late-arriving dimensions before publishing metrics.
Related guides
- Dimensional Modeling: Facts and Dimensions
- Dimension Tables and Conformed Dimensions
- Facts and Dimensions Quick Reference
Declare the grain before choosing measures
Grain is the business meaning of one row. “One row per order” differs from “one row per order line” and “one row per daily product inventory snapshot.” Write the grain as a complete sentence before listing measures or keys. Then verify that every dimension and measure is valid at that level. A column can be present physically yet be misleading if it varies below the declared grain.
For example, a sales fact at order-line grain can include quantity and extended amount for one product line. An order-level shipping fee should not be repeated on every line and then summed without an allocation rule. It may belong in a separate order fact, or it can be distributed across lines using a documented method if users need line-level analysis.
Classify measures by how they aggregate
| Measure type | Example | Aggregation caution |
|---|---|---|
| Additive | Units sold, transaction amount | Can usually sum across compatible dimensions and time |
| Semi-additive | Account balance, inventory on hand | Can sum across entities but often not across time |
| Non-additive | Rate, percentage, unit price | Recalculate from component values instead of summing |
| Count distinct | Unique customers or devices | Counts may overlap across groups; totals may not reconcile by addition |
Document units, currency, sign conventions, inclusion rules and null behavior. Revenue could mean gross billed amount, recognized revenue or net value after returns. A clear name does not replace a governed metric definition. Keep numerator and denominator available for ratios where feasible so aggregates can be recomputed correctly.
Choose a fact pattern that matches the process
A transaction fact records individual events. A periodic snapshot captures state at regular intervals. An accumulating snapshot follows a process from start to completion and updates milestone dates or status as it advances. Different facts can describe the same business area and connect through shared dimensions, provided their grains stay distinct.
Use a transaction fact when event-level detail and flexible rollup matter. Use a snapshot when point-in-time state is central and the volume of raw transitions is impractical for common queries. Use an accumulating snapshot when cycle time between milestones matters, while preserving enough history if stages can repeat or reverse.
Test grain with data and questions
- Count rows and compare them with the expected business event population.
- Check that each declared key is unique at the chosen grain.
- Join dimensions and verify that each fact matches no more than intended.
- Reconcile representative totals against a trusted source or manual sample.
- Test late events, corrections, cancellations and reopened processes.
- Ask consumers to calculate a metric and compare interpretations.
Beware of a dimension that has multiple valid matches for one fact date; a join can multiply measures. Use effective-time logic or an explicit unknown member and repair workflow. For a many-to-many relationship, define allocation or bridge behavior so measures are not accidentally repeated.
- Can a reader state the grain without looking at column names?
- Are measures additive, semi-additive or non-additive?
- Do time and currency roles have explicit meanings?
- Are aggregates and joins reconciled with realistic examples?
Continue to Dimensional Modeling: Facts and Dimensions, Dimension Tables and Conformed Dimensions and Slowly Changing Dimensions: Type 1, 2 and 3.
Review grain and aggregation behavior
Write the grain in plain language and verify that the key uniquely identifies each row. Classify each measure as additive, semi-additive, or non-additive in the relevant dimensions. Include units, currency, and denominator rules.
Test totals across time and dimensions, duplicate joins, and missing dimension members. Use small hand-calculated fixtures. Document whether snapshots represent point-in-time state or events.