Facts and dimensions
Separate events from descriptions
A fact table records something that happened or was observed at a declared grain. In our retail fixture, each row is one order line, not one order. A dimension table describes the things involved in those events: product, customer or business date. Dimensions supply useful labels and grouping fields; facts supply quantities and amounts to summarize. A table with numeric columns is not automatically a fact: a numeric product identifier is a label, not a number to add. A stored numeric fact such as RevenueUSD is also not the same as an explicit DAX measure, which is a named calculation evaluated for the current report context. DAX measures are taught later.
Example 1: choose a grain before choosing columns
Read labs/fixtures/sales.csv and products.csv. L01 records two notebooks at 12 USD each; L02 records one desk lamp at 30 USD. Both belong to O01. Revenue for these two lines is 24 + 30 = 54 USD. Counting rows gives two lines, whereas counting distinct OrderID gives one order. Product P01 appears on L01 and L03; its product description belongs in the product dimension once. Grouping these two lines by P01 yields 60 USD. Across all five sales lines revenue is 200 USD. This is a hand-verified result, not a native report execution.
Example 2: operational source versus analytical model
An order-entry system might store OrderHeader(OrderID, CustomerKey, OrderDate), OrderLine(LineID, OrderID, ProductKey, Quantity, Price), and Product(ProductKey, ProductName, CategoryKey), with a separate Category table. That arrangement helps manage updates without repeatedly storing header information. For reporting, prepare one FactSales row per line, with keys to customer, date and product, and descriptive category on DimProduct. For the synthetic O01, both fact rows carry C01 and 2026-01-05; do not copy an order-level total onto both rows and then sum it. A transformation may join operational tables during preparation; it must preserve the declared fact grain. A star can make common grouping easier, but a flat table can be enough for a tiny single-source report, and a snowflake can be appropriate for specific shared or governed hierarchies.
A small star, read from outside to inside
DimDate (1) |DimProduct (1)--FactSales (*)--(1) DimCustomer | DimRegion (1)Each line represents a separate key relationship: one unique dimension value can describe many sales rows. The asterisk belongs to FactSales for all four relationships. Text alternative: Date, Product, Customer and Region each connect directly to Sales; none needs to connect to another dimension in this fixture. This is a design drawing, not a screenshot. Chapter 08 teaches actual filter propagation and relationship settings.
Common mistakes: do not mix grains
Do not append a monthly product budget to daily order lines and treat every row as a sale. Keep a separate fact table at one row per product per month (plus region if relevant). Do not count repeated order identifiers as distinct orders; do not sum ProductKey or UnitPriceUSD as if they were amounts. If the business needs historical category membership, define how changing labels will be represented before building the model. Chapter 19 develops dimensional history; here all dimension values are fixed for the fixture.
Practice: design tables
Complete task 1 in labs/dimensional-basics/worksheet.md. Classify each field and sketch the source-to-star transformation. Explain why O01 is not a unique fact key and why order-level totals cannot be repeated at line grain.
Official reading
Power BI star schema · Warehouse fact tables · Warehouse dimension tables. Concepts reviewed against documentation extracts; native model creation NOT RUN.