Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Model ambiguity workaround advice

Hi   I am running into the classic issue of not being able to create an active relationship between two tables, because it would introduce ambiguity to the model.   I've read a dozen or so questi...
  • v-alq-msft's avatar
    5 years ago

    Hi, Anonymous 

     

    Cross filtering both directions works well for a star shema like below.

     

    While cross filtering direction does not work well as below with loops.

     

    The above model can create an ambiguous set of relationships. For instance, if you sum up a field from TableX and then choose to filter by a field on TableY, then it’s not clear how the filter should travel, through the top table or the bottom table. For further information, you may refer to the document .

     

    If the relationships are all active In your model, when you sum up a field from 'Transcation' and then choose to filter by a field on Date. Then it is not clear how the filter should travel, through 'Date'=>'Transcation' or 'Date'=>'Merchant'=>'Transcation'. 

     

    You may make the relationship between 'Date' and 'Merchant' inactive. Then you can use USERELATIONSHIP to get the result according to the slicer.

    Here is a example about 'USERELATIONSHIP'. The pbix file is attached in the end.
    Table:


    Calendar:

     

    There are two inactive relationships between two tables.

     

    Then you can create measures to calculate the sum of 'Val' filter by 'Calendar[Date]' use filter 'CalendarDate'=>'Table[Date1]' or 'CalendarDate'=>'Table[Date2]'.

     

     

    Measure1 = 
    CALCULATE(
        SUM('Table'[Val]),
        USERELATIONSHIP('Table'[Date1],'Calendar'[Date])
    )
    Measure2 = 
    CALCULATE(
        SUM('Table'[Val]),
        USERELATIONSHIP('Table'[Date2],'Calendar'[Date])
    )

     

     

     

     

    Result:

     

    Best Regards

    Allan

     

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