Relationship cardinality
A relationship connects matching key values
In Power BI a model relationship defines how a filter can travel between tables. It does not copy a product name onto every sales line or rewrite either source CSV. Cardinality describes whether matching column values must be unique on a side of the relationship. For this chapter, use an Import model, the clean V007 retail fixture and single-direction relationships unless stated otherwise. The product dimension has one row per product; the fact has one row per sale line. A relationship joins these different grains logically for analysis.
Read the cardinality symbols
1:* means one-to-many: the first column is unique, while the second can repeat. *:1 describes the same shape with the sides reversed. 1:1 requires uniqueness on both sides. *:* allows repeated keys on both sides; it is a separate modeling choice, not a fix for broken dimension keys. A many side can happen to contain unique values today without changing its intended business grain. Set the relationship from the intended grain and validate the data, rather than guessing from a small preview. Both key columns should use compatible types and values; text identifiers with leading zeros should stay text.
Example 1: validate the product relationship
Load labs/fixtures/products.csv as DimProduct and labs/fixtures/dimensional-v1/fact-sales.csv as FactSales. The dimension keys P01, P02 and P03 occur once each. The fact has P01 twice, P02 twice and P03 once. Create or inspect the relationship on ProductKey: DimProduct (1) to FactSales (*), active, Single. In Model view check the 1 and * labels, and the arrow pointing from dimension to fact. If the dialog displays FactSales first, select many-to-one and confirm the same direction. Desktop may propose a relationship automatically; review its columns, cardinality and active state rather than trusting the suggestion. The five clean facts still total 200 USD. A table grouped by product should show Notebook 60, Desk Lamp 90 and Backpack 50.
Example 2: distinguish duplicate lookup keys from missing keys
Inspect products-dirty.csv separately: P01 occurs twice. The dirty table cannot be the unique side of the intended relationship. Resolve the duplicate with an authoritative business rule or quarantine the conflict; do not merely select many-to-many. Next keep the clean dimension and use the isolated relationships-v1/fact-sales-orphan.csv: it adds L06, P99, 20 USD. P99 has no dimension record. For a regular one-to-many Import relationship this integrity violation can create a virtual blank member on the one side. Expected group totals are Notebook 60, Desk Lamp 90, Backpack 50 and a blank product grouping 20; the grand total is 220. The blank is not evidence of a literal blank product row in the CSV. Inspect unmatched keys before deciding whether to map them to a real Unknown dimension member or reject them under an approved rule.
Avoid treating cardinality as a cleaning tool
A physical join in a source query and a model relationship are different mechanisms. An inner join could lose P99, while a regular model relationship can preserve its contribution via an unknown grouping. Limited relationships, including many-to-many cardinality and cross-source-group relationships, have different evaluation behavior and do not add the same virtual blank row. They are deferred to later chapters. Do not generalize these expected Import-model results to DirectQuery or composite models. Native evaluation remains untested.
Practice: audit both sides
Complete task 1 in labs/relationships/worksheet.md. Record the grain, key counts, duplicate keys and unmatched fact keys for each fixture. Propose a one-to-many design and explain how to preserve an audit trail when fixing invalid keys.
Official reading
Model relationships · Create and manage relationships · Relationship troubleshooting. Examples are predictions, native Desktop NOT RUN.