Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Let's say I have two columns A = (1|2|3) and B = (2|3|4).
How can I check if they contain any common values? In the above case, the result I want is True.
For A = (1|2|3) and B = (5|6|7), the result should be false as there are no common values.
I need a DAX solution as I need to use this in Row Level Security.
Solved! Go to Solution.
Here's a DAX solution.
A common B =
var ta = SELECTCOLUMNS(ADDCOLUMNS(GENERATESERIES(1,PATHLENGTH([A])),"Item",PATHITEM([A],[Value])),"Item",[Item])
var tb = SELECTCOLUMNS(ADDCOLUMNS(GENERATESERIES(1,PATHLENGTH([B])),"Item",PATHITEM([B],[Value])),"Item",[Item])
return COUNTROWS(INTERSECT(ta,tb))>0
Hi @pythongtdax ,
Table.
Please try this measure.
Result = IF(COUNTROWS(INTERSECT(VALUES('Table'[A]),VALUES('Table'[B])))>0,TRUE(),FALSE())
Table2.
Measure.
Result_2 = IF(COUNTROWS(INTERSECT(VALUES('Table2'[A]),VALUES('Table2'[B])))>0,TRUE(),FALSE())
Attach the PBIX file for reference. Hope it helps.
Best Regards,
Community Support Team_Gao
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
Here's a DAX solution.
A common B =
var ta = SELECTCOLUMNS(ADDCOLUMNS(GENERATESERIES(1,PATHLENGTH([A])),"Item",PATHITEM([A],[Value])),"Item",[Item])
var tb = SELECTCOLUMNS(ADDCOLUMNS(GENERATESERIES(1,PATHLENGTH([B])),"Item",PATHITEM([B],[Value])),"Item",[Item])
return COUNTROWS(INTERSECT(ta,tb))>0
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
74 | |
63 | |
51 | |
47 |
User | Count |
---|---|
211 | |
85 | |
64 | |
59 | |
56 |