From books

Lesson 4 · Declare the grain before anything else; the rest of the model follows from it.

Ralph Kimball, Margy Ross · The Data Warehouse Toolkit · 2013 · Kimball Group, Dimensional Modeling Techniques — Four-Step Dimensional Design Process (aceiași pași ca în The Data Warehouse Toolkit, ed. a 3-a, cap. 3)2 minutes read
Select the business process. Declare the grain. Identify the dimensions. Identify the facts.Ralph Kimball, Margy Ross · The Data Warehouse Toolkit · 2013 · Kimball Group, Dimensional Modeling Techniques — Four-Step Dimensional Design Process (aceiași pași ca în The Data Warehouse Toolkit, ed. a 3-a, cap. 3)

The grain is a sentence: "one row = one receipt line, in one store, on one day".

Kimball's four steps come in that order for a reason. The business process is something that happens — a sale, a payment, a shipment — not a department. The grain is the sentence that says what one row of the fact table stands for: "one receipt line, in one store, on one day". Only then come the dimensions — who, what, where, when, the descriptive context — and the facts, the numeric measures that can be added up at the chosen grain. The result is the star schema: a narrow, long fact table with foreign keys to wide, denormalised dimensions, each carrying a surrogate key (an integer minted by the warehouse, not the code from the source). The classic mistake is to mix grains — order lines and order totals in the same table — and get doubled sums in the first report. The second mistake is three slightly different "Customer" dimensions; conformed dimensions, shared by every process, are what make two reports comparable.

Why it mattersA fact table with an undeclared grain produces figures that contradict each other across reports, and nobody can say which one is right.

ProcessGrainDimensionsFacts
The order is not negotiable: facts can only be summed at a declared grain.
Open on YouTube

Back to the feed