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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

DAX Contains with filter condition

Hi,
I have 2 tables (TableA and TableB) both have Name fields and TableB has a field called Status. Now, I want to compare both the tables on the Name field.
Condition 1: Compare only the Names that have the status = TRUE in TableB with the names in TableA.

Condition 2: After the comparison, return the output as "Matched" if both the tables have that name. If not, return "Not-Matched".
I tried something like this, but not able to put the filter to select only status = TRUE from TableB.

 

 

COLUMN = IF(
CONTAINS('TableB','TableB'[Name] ,'TableA'[Name])
, "Matched"
, "Not-Matched"
)

 

 

This is how my tables look like

TableA
Name
Smith
Joe
John
Paul
Arjun
Rahul
Ajay
Rajesh

 

TableB
NameStatus
SmithTRUE
JoeTRUE
JohnFALSE
PaulTRUE
RahulTRUE
RajeshTRUE
AjayFALSE
ArjunFALSE

 

Can someone please help, with the same?

Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column in Table B

new column = if(isblank(countx(filter(TableA, TableA[NAme] =TableB[Name]),TableA[Name])),"False","True")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Anonymous 
Your dax is check whether the table contains the names in other table. If that is the case, you can try create this column in TableB. 

 

new column = IF([Name] in VALUES(TableA[Name])&&[Status]=TRUE(),"Matched","Not Matched")

 

If you want to compare names in each row, use this column:

 

new column = IF([Name]=RELATED(TableA[Name])&&[Status]=TRUE(),"Matched","Not Matched")

 

 

Both dax returns the same results with your sample table, but there is a difference if you applied it to real data.


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

amitchandak
Super User
Super User

@Anonymous , Try a new column in Table B

new column = if(isblank(countx(filter(TableA, TableA[NAme] =TableB[Name]),TableA[Name])),"False","True")

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors