Keys and star schema
Use a stable key to connect tables
A key identifies an entity or a row at its declared grain. A natural key comes from the business, such as P01 in a product catalog. A surrogate key is an assigned identifier, such as integer 101, with no business meaning. A fact foreign key refers to a dimension key. A surrogate is helpful when source identifiers collide or when multiple versions of a business entity must be distinguished; it does not magically remove duplicate or missing business keys. Power BI relationships link individual columns, so a composite business key may need a carefully constructed single stable key or an upstream surrogate. Keep the mapping reproducible across refreshes; a freshly sorted row number is not automatically stable.
Example 1: trace a product key and reconcile
In the lab, DimProduct retains the existing natural ProductKey. The three product keys P01, P02 and P03 are unique. FactSales contains P01 twice, P02 twice and P03 once. A filter for Stationery identifies P01, which corresponds to L01 and L03 and 24 + 36 = 60 USD. Home gives 90 USD and Travel gives 50 USD. The categories reconcile to 200 USD. For a conceptual surrogate alternative, assign P01 -> 101, P02 -> 102, P03 -> 103 and replace the fact link values using the same mapping. The grouping totals must remain unchanged. The source key still belongs in the dimension for reconciliation. We do not change the original product keys in the actual lab.
Example 2: audit duplicates and orphan links
Suppose a new sales line refers to P99 and the product list has no P99. That is an orphan key. In the dirty fixture P01 is also repeated in the product lookup. Joining the clean sales to that duplicate lookup can yield seven rows and 260 USD rather than five rows and 200 USD. A valid relationship requires uniqueness on its proposed one side. A missing key needs an explicit policy: reject and log the row, or map it to a deliberately designed unknown member and keep its amount visible. Never silently discard it or choose the first conflicting product description. Power BI can surface unmatched data through blank grouping in some relationship configurations; that is not a substitute for a data quality audit. Chapter 08 covers detailed behavior.
Build the model on paper, then optionally in Desktop
The companion lab adds an invented order-to-customer mapping and a calendar from January 1 through December 31, 2026. The calendar has 365 unique dates and covers all fixture dates; date columns must be typed as dates. Keep OrderID and LineID as text. Import the prepared files into an isolated report if Desktop is available. Use Model view to inspect each of the four relationships, from dimension key (one) to corresponding fact key (many), with active single-direction filtering from dimension to fact for this simple star. Check auto-created relationships rather than accepting them blindly. Confirm all fact keys resolve; hiding a key from report authors does not enforce security. No date-intelligence setup or DAX is required here.
Conformed dimensions and separate facts
A conformed dimension uses shared business definitions and consistent keys so it can describe more than one fact table. Product and date can describe both sales lines and daily inventory snapshots; customer cannot meaningfully filter inventory in this fixture because stock is not customer-specific. Do not connect the fact tables directly by ProductKey, which repeats in both. Keep each fact at its own grain and use shared dimensions for comparable grouping. A region may need a mapping if sales regions and warehouse locations mean different things. The model should reflect actual business semantics, not just equal-looking column names.
Practice: validate key mappings
Complete task 2 in labs/dimensional-basics/worksheet.md. Check dimension key uniqueness, matching key types, zero orphan counts and unchanged revenue after joining dimensions. Test the hypothetical P99 and repeated P01 conditions separately. Explain when an unknown-member policy would be appropriate.
Official reading
Relationship concepts · Star schema · Date-table guidance · Dimensional load guidance. Native relationship creation NOT RUN.