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
Digger
Post Patron
Post Patron

Convert Many to one relation to one to one

I need compare two tables by text columns

Table1[MatchCol] has only unique text

Table2[MatchCol] has dublicates

 

I need found all MatchCol Ids from Table1 and Table2, to know which Ids from Table1[MatchCol] matches Table2[MatchCol] and wise versa (find difference in Tables)

 

one to one relations do this tricks but only with both tables unique values, and i got error "The cardinality you selected isnt valid for this relationship

How to do that? 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Here is one way without changing the relationship:

model.png

 

Matching = 
COUNTROWS(
    INTERSECT(VALUES('Table 1'[T1]), VALUES('Table 2'[T2])))
No Match in T2 =
SUMX (
    VALUES ( 'Table 1'[T1] ),
    CALCULATE (
        IF (
            ISBLANK ( MAX ( 'Table 1'[T1] ) ),
            BLANK (),
            COUNTROWS ( EXCEPT ( VALUES ( 'Table 1'[T1] ), VALUES ( 'Table 2'[T2] ) ) )
        )
    )
)
No Match in T1 = 
COUNTROWS(EXCEPT(VALUES('Table 2'[T2]), VALUES('Table 1'[T1])))

match.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

Here is one way without changing the relationship:

model.png

 

Matching = 
COUNTROWS(
    INTERSECT(VALUES('Table 1'[T1]), VALUES('Table 2'[T2])))
No Match in T2 =
SUMX (
    VALUES ( 'Table 1'[T1] ),
    CALCULATE (
        IF (
            ISBLANK ( MAX ( 'Table 1'[T1] ) ),
            BLANK (),
            COUNTROWS ( EXCEPT ( VALUES ( 'Table 1'[T1] ), VALUES ( 'Table 2'[T2] ) ) )
        )
    )
)
No Match in T1 = 
COUNTROWS(EXCEPT(VALUES('Table 2'[T2]), VALUES('Table 1'[T1])))

match.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






amitchandak
Super User
Super User

@Digger , Best to keep one to many, unless there is an issue because of that

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