Forum Discussion

amirghaderi's avatar
amirghaderi
Helper IV
4 years ago
Solved

Conditional joins between tables

I have Table A which can have only link with one of Table B and Table C. As per example, for project 100/300 it has relationship with table B and for project 200, it has relationship with table C. How can I build this relationship in Power Bi?

 

  • Hi, amirghaderi 

    If no relationship has been established between tableB and tableC, you can try to create many-to-many relationship  between tables like below:

    You can aslo try to add a dimension table.

    Project = DISTINCT(UNION(VALUES(TableA[ProjectFundTask]),VALUES(TableB[ProjectToptask]),VALUES(TableC[Project WBS])))

    Then you can establish relationships through this dimension table.

    Best Regards,
    Community Support Team _ Eason

     

     

2 Replies

  • What happens if you create and use both relationships?

     

    Here is an alternative but it isn't strictly necessary. Create both relationships. Mark both as inactive.  In your measure use USERELATIONSHIP filters as needed.

  • v-easonf-msft's avatar
    v-easonf-msft
    Community Support

    Hi, amirghaderi 

    If no relationship has been established between tableB and tableC, you can try to create many-to-many relationship  between tables like below:

    You can aslo try to add a dimension table.

    Project = DISTINCT(UNION(VALUES(TableA[ProjectFundTask]),VALUES(TableB[ProjectToptask]),VALUES(TableC[Project WBS])))

    Then you can establish relationships through this dimension table.

    Best Regards,
    Community Support Team _ Eason