Relationships
How Power BI relationships work: one-to-many, one-to-one, and many-to-many cardinality, filter direction, active and inactive relationships, and the mistakes to avoid.
Relationships
Relationships define how tables connect inside a Power BI data model.
They allow filters and calculations to move between tables.
In a star schema:
- Dimension tables filter fact tables.
- Fact tables store the business events.
- Relationships connect the two.
Example:
DimDate
|
|
DimCustomer --- FactSales --- DimProduct
|
|
DimStoreWithout relationships, Power BI treats tables as separate datasets.
How Relationships Work
A relationship connects two tables using matching columns.
Example:
DimProduct
ProductKey
ProductName
Categoryconnects to:
FactSales
ProductKey
Quantity
SalesAmountThe shared column:
ProductKey
creates the relationship.
Every relationship has the same four parts, shown together below: the shared key, its cardinality, which direction filters travel, and whether it's the active path between the two tables.
Anatomy of a Relationship
DimProduct (one side)
| ProductKey | ProductName |
|---|---|
| 10011 | Tire A |
| 1002 | Tire B |
FactSales (many side)
| OrderID | ProductKey | SalesAmount |
|---|---|---|
| 5001 | 10011 | 250 |
| 5002 | 1001 | 400 |
| 5003 | 1002 | 180 |
4Active vs. inactive: FactSales can have more than one relationship to DimDate
Reaching the inactive one takes an explicit USERELATIONSHIP(FactSales[ShipDateKey], DimDate[DateKey]) inside CALCULATE().
ProductKey — the shared key column. It's unique in DimProduct but repeats in FactSales; that difference is what defines which side is "one" and which is "many."
Cardinality (1 : *) — one row in DimProduct can match many rows in FactSales, never the other way around.
Filter direction — by default, selections on the dimension side filter the fact side, not the reverse. Bidirectional filtering flips this arrow into a two-way street, which is why it's used sparingly.
Active vs. inactive — a table can have more than one relationship to the same other table, but only one is used automatically. The rest sit dormant until a measure calls them by name.
One-to-Many Relationships
The most common Power BI relationship is:
Dimension Table
|
| 1 : Many
|
Fact TableExample:
DimProduct
ProductKey | ProductName
-----------|------------
1001 | Tire A
1002 | Tire BFact table:
FactSales
ProductKey | SalesAmount
-----------|------------
1001 | 250
1001 | 400
1002 | 180One product can have many sales records.
Relationship Cardinality
Cardinality describes how rows match between tables.
Power BI supports:
One-to-Many (1:*)
Most common relationship.
Example:
DimCustomer
|
| 1 : Many
|
FactSalesOne customer can have many sales transactions.
One-to-One (1:1)
Both tables contain unique values.
Example:
Employee
|
| 1 : 1
|
EmployeeDetailsThis is less common in analytical models.
Many-to-Many (:)
The key column has repeated values on both sides.
Example: a budget table set by category, related to the product table on Category. A budget row exists per category, and the product table has many products per category, so neither side is unique:
Budget DimProduct
Category | Budget Product | Category
---------|------- ---------|---------
Bikes | 200,000 Tire A | Bikes
Clothing | 90,000 Tire B | Bikes
Jersey | ClothingMany-to-many relationships can create:
- Ambiguous filtering
- Unexpected calculations
- Complex DAX
Use carefully.
Filter Direction
Relationships control how filters travel.
Example:
DimProduct
|
v
FactSalesSelecting:
Category = "Off Road"
filters:
DimProduct
↓
FactSalesThe result:
Only Off Road sales are calculated.
Single Direction Filtering
Recommended for most star schemas.
Example:
DimProduct
|
v
FactSalesFilters move from dimension to fact.
Benefits:
- Easier to understand
- Better performance
- Fewer ambiguous paths
Both Direction Filtering
Power BI allows filters to travel both directions.
Example:
DimProduct
↕
FactSalesUse carefully.
Problems can include:
- Circular relationships
- Ambiguous filter paths
- Incorrect results
Most enterprise models avoid unnecessary bidirectional filtering.
Active and Inactive Relationships
A table can contain multiple relationships.
Example:
FactSales
OrderDateKey
ShipDateKeyBoth connect to:
DimDate
However, only one relationship can be active.
Example:
FactSales[OrderDateKey]
Active
DimDate[DateKey]The other relationship becomes inactive.
Use DAX to activate inactive relationships:
Sales by Ship Date =
CALCULATE(
[Total Sales],
USERELATIONSHIP(
FactSales[ShipDateKey],
DimDate[DateKey]
)
)Relationship Best Practices
Follow these guidelines:
- Use one-to-many relationships whenever possible.
- Filter from dimensions to facts.
- Avoid unnecessary bidirectional filtering.
- Use clear key columns.
- Maintain a star schema structure.
Recommended:
DimCustomer
|
|
FactSales
|
|
DimProductAvoid:
FactSales
|
|
FactInventoryInstead:
DimProduct
|
FactSales ---+
|
FactInventoryCommon Relationship Mistakes
Missing Relationships
Symptoms:
- Incorrect totals
- Filters do not work
- Visuals show unexpected results
Incorrect Cardinality
Example:
Setting:
Many-to-Many
when the model should be:
One-to-Many
can create calculation problems.
Multiple Filter Paths
Two active routes between the same tables make filters ambiguous:
FactSales --> DimStore --> DimRegion (route 1, through Store)
FactSales --------------> DimRegion (route 2, direct)Power BI won't make the second route active. Bidirectional relationships are the usual way extra routes appear. See You can't create a direct active relationship.
Relationship Checklist
A good Power BI model should have:
- Clear relationships
- Proper cardinality
- Dimension-to-fact filtering
- Minimal bidirectional relationships
- Consistent key columns
Next Steps
Continue learning Power BI data modeling:
Advanced Topics:
Hitting an error building a relationship? See Column Contains a Duplicate Value for how to find and fix it.
A visual failing with "Couldn't load the data for this visual"? An inactive or ambiguous relationship is one of the four usual causes — see Couldn't Load the Data for This Visual.
Dimension Tables
What dimension tables are in a Power BI star schema, how to structure date, product, and customer dimensions, and how dimension keys relate them to facts.
DirectQuery vs. Import
Learn the difference between Import, DirectQuery, and Composite storage modes in Power BI, and when to use each.