Sub topic 10
Ambiguous Paths and Why Power BI Blocks Them
This chapter assumes you can create relationships in the Model view and know the difference between single and both cross-filter directions. You should also know what an active relationship is.
What an ambiguous path is
A filter path is the route a filter takes from one table to another through relationships. A path is ambiguous when two or more routes connect the same pair of tables. The engine would have to guess which route to use, and each route can give a different answer.
Power BI does not guess. When you create a relationship that would make a second active route, it makes the new relationship inactive or shows a warning. It may also refuse the both-direction setting with a message about ambiguity.
A common example
Suppose Sales has two date columns, OrderDate and ShipDate. Both relate to 'Date'[Date]. These two relationships make two routes between Sales and Date. Only one can be active.
A subtler case appears with a both-direction chain:
A filter on Region can reach Sales in two ways. One is direct. The other goes through Store. If both routes were active, a region filter could be applied twice, or in different ways.
Why this matters
Consider what each route means:
- The direct route filters
Salesby the region stored on each sale. - The route through
StorefiltersSalesby the region of the store that made the sale.
These can disagree. A sale made in a store in one region could be shipped to a customer in another. The two routes would return different totals, and the report would give no sign of which one you got.
How Power BI resolves it
Power BI follows three rules.
- Only one active relationship can exist between two tables at a time.
- Only one active route can connect any two tables, directly or indirectly.
- If a new relationship would break rule 2, Power BI creates it as inactive, or blocks a both-direction setting that would create the ambiguity.
Inactive relationships remain in the model. You use them on demand with USERELATIONSHIP, as in this measure:
Sales by Ship Date =
CALCULATE (
[Total Sales],
USERELATIONSHIP ( Sales[ShipDate], 'Date'[Date] )
)This measure uses the inactive ShipDate route only inside the CALCULATE. The active OrderDate route stays in place for all other measures.
How to fix an ambiguity warning
- Open the Model view and find the two tables named in the message.
- Trace every route between them. Look for dimension tables that connect to each other, not only to the fact table.
- Decide which route is the correct business meaning.
- Set the other relationship to inactive, or change its direction to single.
- If you need the other route in some measures, use
USERELATIONSHIPfor those measures. - If two dimensions are linked directly, consider removing that link and relating both to the fact table only.
Exercise
A Region table relates to Sales directly, and also to Store, which relates to Sales. Power BI makes one of these relationships inactive. Why, and how can you still use that relationship in a measure?
Show answer
Two active routes from Region to Sales would be ambiguous, because a region filter could produce different results along each route. Power BI keeps one route active and sets the other to inactive. You can use the inactive relationship in a measure by wrapping the calculation in CALCULATE with USERELATIONSHIP naming the two columns of that relationship.