The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
Solved! Go to Solution.
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
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
Thank you very much, Dale.
User | Count |
---|---|
65 | |
62 | |
60 | |
53 | |
28 |
User | Count |
---|---|
181 | |
82 | |
67 | |
48 | |
44 |