Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
payom
Frequent Visitor

How can I join tables with OR in condition on PowerBI Report?

Hello,
I have a problem about joining two tables with OR condition.
Please help.

Eg.
Table : Campaign
field : CampaignID, CampaignName

Table : Register
field : RegisterID, CustomerID, RegisterDate, RegisterCampaignID, MediaCampaignID


I have Campaign as a Slicer on Power BI report.
and I want to retrieve Register data by selected Campaign
with condition likes this :
Campaign A inner join Register B
on (A.CampaignID = B.CampaignID
OR A.CampaignID = B.MediaCampaignID)


Please help me, is there any way to do this on report?


Thank you.

1 ACCEPTED SOLUTION
v-jiascu-msft
Employee
Employee

Hi @payom,

 

Usually, we don't need to join tables. But you still can do it in these ways. 

1. Join in the Query Editor. Pleas download this demo for details: https://1drv.ms/u/s!ArTqPk2pu-BkgUr3Z6TK1Q_VI9S-

2. By DAX.

2.1 Create two relationships.

2. 2 Use this formula to create a new calculated table.

Table =
UNION (
    NATURALINNERJOIN ( 'Campaign', 'Register' ),
    CALCULATETABLE (
        NATURALINNERJOIN ( 'Campaign', Register ),
        USERELATIONSHIP ( Campaign[CampaignID], Register[ MediaCampaignID] )
    )
)

Best Regards!

Dale

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

View solution in original post

2 REPLIES 2
v-jiascu-msft
Employee
Employee

Hi @payom,

 

Usually, we don't need to join tables. But you still can do it in these ways. 

1. Join in the Query Editor. Pleas download this demo for details: https://1drv.ms/u/s!ArTqPk2pu-BkgUr3Z6TK1Q_VI9S-

2. By DAX.

2.1 Create two relationships.

2. 2 Use this formula to create a new calculated table.

Table =
UNION (
    NATURALINNERJOIN ( 'Campaign', 'Register' ),
    CALCULATETABLE (
        NATURALINNERJOIN ( 'Campaign', Register ),
        USERELATIONSHIP ( Campaign[CampaignID], Register[ MediaCampaignID] )
    )
)

Best Regards!

Dale

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

Thank you very much, Dale.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.