Relationships are the lines connecting your star-schema tables. They're what let a slicer on the Date dimension filter the Sales fact table. Understanding cardinality and filter direction is essential — most "my totals are wrong" problems trace back to a relationship set up incorrectly.
What relationships do
A relationship joins a column in one table to a column in another (usually a dimension's key to a fact's key). Filters then flow across it: pick "January" in the Date dimension and only January's fact rows are considered. You build them in the Model view by dragging one key onto another.
Cardinality
The relationship type — almost always one-to-many in a star schema:
| Type | Meaning |
|---|---|
| One-to-many (1:*) | One dimension row → many fact rows (the norm) |
| Many-to-one (*:1) | The same thing, from the fact side |
| One-to-one (1:1) | Rare — usually two tables that should be one |
| Many-to-many (*:*) | Powerful but tricky — avoid unless needed |
Filter direction
By default filters flow from the "one" side (dimension) to the "many" side (fact) — single direction, which is exactly what a star schema wants. You can set both directions (bidirectional), but do so sparingly:
Active & inactive relationships
Two tables can only have one active relationship (the solid line filters flow through automatically). Extra relationships are inactive (dashed) — for example, an Order Date and a Ship Date both linking to the Date table. Activate an inactive one inside a measure with USERELATIONSHIP:
Sales by Ship Date =CALCULATE([Total Sales],USERELATIONSHIP(Sales[ShipDate], 'Date'[Date]))
Practice
In Model view, create one-to-many relationships from each dimension to your Sales fact. Confirm a Date slicer filters the sales total. Add a second date column (ship date) as an inactive relationship and write a measure that uses it via USERELATIONSHIP.
Key takeaways
- 01Relationships join tables so filters flow across them (dimension → fact).
- 02Star schemas use one-to-many relationships; avoid many-to-many unless truly needed.
- 03Keep filter direction single (dimension → fact); bidirectional causes ambiguity and slowness.
- 04Only one active relationship exists between two tables; extras are inactive (dashed).
- 05Activate an inactive relationship inside a measure with USERELATIONSHIP.
