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

Find matching values in many-to-one relation

Hey all,

 

Currently I am having trouble with matching 2 columns (A and B) in 2 different tables (Table 1 and Table2). These columns have a Many-to-One relationship (Table1[A] to Table2[B] = n:1). I am trying to find out for all values in B if these exist in A (Outcome as provided in Table2[Exists in A?]).

 

What would this problem be solved in the easiest method?

 

MWE:

Table1

IndexA
1

This value

2Another value
3This value
4Not this value
5This is a string
6Another value

 

Table2

IndexBExists in A?
1This valueYes
2Another valueYes
3More values

No

4This is a stringYes
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

If you only want to campare column [A] and [B].

Column1 = IF(Table2[B] in VALUES(Table1[A]),"YES","NO")
If you want to comapre both index and columns.
Column2 = IF(Table2[B] = LOOKUPVALUE(Table1[A],Table1[Index],Table2[Index]),"YES","NO")
vjaywmsft_0-1651730566982.png

 

Best Regards,

Jay

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

If you only want to campare column [A] and [B].

Column1 = IF(Table2[B] in VALUES(Table1[A]),"YES","NO")
If you want to comapre both index and columns.
Column2 = IF(Table2[B] = LOOKUPVALUE(Table1[A],Table1[Index],Table2[Index]),"YES","NO")
vjaywmsft_0-1651730566982.png

 

Best Regards,

Jay

CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1651341302399.png

 

What's worth mentioning is,

your data model is a typically negative example to avoid, namely "referential integrity violation". Easy to google this jargon and enough solutions to it.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Anonymous
Not applicable

Funny you would mention the "referential integrity violation" because what I am looking for in the real problem is actually a method to spot these violations and mark them such that these are easy to find and can be dealt with.

SpartaBI
Community Champion
Community Champion

@Anonymous add this column:

SpartaBI_0-1651340540522.png

Exist in A? = 
    IF(
        Table2[Value] IN CALCULATETABLE(VALUES(Table1[Value])),
        "Yes",
        "No"
    )

 

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