Forum Discussion

DavidCunningham's avatar
DavidCunningham
Frequent Visitor
1 year ago
Solved

Model View "ambigous path" issues

Hi,

 

I have a very simple data set up. A policy table, a cost table and a date table. 

 

The policy and cost tables are connected in the model view via a policy ID (1 to many), a unique policy ID number attributed to each policy sold.

 

When i then try and connect the date table to both the policy and cost tables on date- policy sold date and date to cost incurred date, it wont let me. It states there is an "ambigious path between cost and date".

 

If i remove the first connection on policy Id, it will then allow me to connect on date. I dont understnad it really as the date and policy id fields are not connected.

 

Many thanks

David 

  • Hi DavidCunningham 

    The issue you're facing occurs because Power BI does not allow more than one relationship between two tables, even if the connection is indirect via a third table, like your date table. This is done to prevent ambiguous paths in the data model, which could lead to unclear or inconsistent calculations.

    Why this happens:
    When you connect the Date table to both the Policy table (via the policy sold date) and the Cost table (via the cost incurred date), Power BI detects an indirect path between the Cost table and the Date table through the Policy table (Policy -> Date <- Cost). This creates ambiguity because Power BI doesn’t know which path to use for filtering, so it blocks the second relationship.

    How to solve this:
    Instead of having two active relationships, you can:

    1. Keep one relationship active and set the other as inactive.
    2. Use the USERELATIONSHIP function in DAX to activate the inactive relationship for specific calculations when needed.
    For more detailed suggestion 

    please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

     

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

  • To resolve this, you can do one of the following:

    Use a Single Active Relationship: You can have a single, active relationship between Cost Table and Date Table. In this case, you would either:

    Keep the relationship between Cost Table and Date Table as the active one and leave the relationship between Policy Table and Date Table inactive, or
    Keep the relationship between Policy Table and Date Table as the active one and leave the relationship between Cost Table and Date Table inactive.
    You can then use the USERELATIONSHIP DAX function to activate the inactive relationship dynamically when needed.

    For example:

    dax
    Copy code
    Total Cost =
    CALCULATE(
    SUM(Cost[Amount]),
    USERELATIONSHIP(Cost[CostIncurredDate], Date[Date])
    )
    This allows you to use the inactive relationship between Cost and Date when calculating the total cost, while still keeping the model clear.

    Remove One of the Relationships: If the relationship between the Policy Table and Date Table is not necessary for your analysis, you could remove it and only keep the relationship between Cost Table and Date Table. However, this may not be ideal if the Policy Sold Date is critical for your analysis.

    Use a Bridge Table: If you have complex scenarios with multiple date-related fields, consider using a bridge table that can link both the Policy and Cost tables to the Date table without causing ambiguity. You could create a table that consolidates dates from both tables and create one-to-many relationships with that bridge table.

  • Hi DavidCunningham

    If this is how you're trying to setup your relationships, an ambiguous relationship is inevitable if you create a second relationship from the Date table. You're attempting to filter the Cost table based on policy numbers from the Policy table, which is already being filtered by the Date table through the policy date. At the same time, the Date table is trying to apply a direct filter on the cost incurred date. This creates a conflict: which filter should take precedence?

     

3 Replies

  • Hi DavidCunningham 

    The issue you're facing occurs because Power BI does not allow more than one relationship between two tables, even if the connection is indirect via a third table, like your date table. This is done to prevent ambiguous paths in the data model, which could lead to unclear or inconsistent calculations.

    Why this happens:
    When you connect the Date table to both the Policy table (via the policy sold date) and the Cost table (via the cost incurred date), Power BI detects an indirect path between the Cost table and the Date table through the Policy table (Policy -> Date <- Cost). This creates ambiguity because Power BI doesn’t know which path to use for filtering, so it blocks the second relationship.

    How to solve this:
    Instead of having two active relationships, you can:

    1. Keep one relationship active and set the other as inactive.
    2. Use the USERELATIONSHIP function in DAX to activate the inactive relationship for specific calculations when needed.
    For more detailed suggestion 

    please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

     

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

  • Hi DavidCunningham

    If this is how you're trying to setup your relationships, an ambiguous relationship is inevitable if you create a second relationship from the Date table. You're attempting to filter the Cost table based on policy numbers from the Policy table, which is already being filtered by the Date table through the policy date. At the same time, the Date table is trying to apply a direct filter on the cost incurred date. This creates a conflict: which filter should take precedence?

     

  • To resolve this, you can do one of the following:

    Use a Single Active Relationship: You can have a single, active relationship between Cost Table and Date Table. In this case, you would either:

    Keep the relationship between Cost Table and Date Table as the active one and leave the relationship between Policy Table and Date Table inactive, or
    Keep the relationship between Policy Table and Date Table as the active one and leave the relationship between Cost Table and Date Table inactive.
    You can then use the USERELATIONSHIP DAX function to activate the inactive relationship dynamically when needed.

    For example:

    dax
    Copy code
    Total Cost =
    CALCULATE(
    SUM(Cost[Amount]),
    USERELATIONSHIP(Cost[CostIncurredDate], Date[Date])
    )
    This allows you to use the inactive relationship between Cost and Date when calculating the total cost, while still keeping the model clear.

    Remove One of the Relationships: If the relationship between the Policy Table and Date Table is not necessary for your analysis, you could remove it and only keep the relationship between Cost Table and Date Table. However, this may not be ideal if the Policy Sold Date is critical for your analysis.

    Use a Bridge Table: If you have complex scenarios with multiple date-related fields, consider using a bridge table that can link both the Policy and Cost tables to the Date table without causing ambiguity. You could create a table that consolidates dates from both tables and create one-to-many relationships with that bridge table.