Skip to content
BENIBIX Learn

Grain

Data🗄️ Storage & WarehousingDimensional Modeling

Also known as Fact Table Grain, Table Grain, Granularity

What one row of a table stands for, such as one sale or one day.

Think of it like

It is like slicing bread. Thin slices can be stacked up, but a thick slice cannot be made thin again.

Example

A table with one row per receipt can say how much each visit spent. Only a table with one row per item can say which product sold.

Why it matters

A wrong grain gives wrong totals. Mixing two grains in one table counts some sales twice.

Definition

The grain of a table says what one row stands for. One row per receipt and one row per item on a receipt are two different grains. The grain is chosen first, before any columns. Every number in the table must match it. A finer grain means more rows, but more questions can be answered.
The same sales at two grains. Only the finer one can say which product sold.

Common mistake

Never writing the grain down. Then someone adds daily totals to a table of single sales, and the sums come out too big.

Key takeaways

  1. 1
    Decide it first. Pick the grain before the columns.
  2. 2
    One per table. Never mix two grains.
  3. 3
    Finer answers more. Rows can be summed, not split.