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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
StuartSmith
Power Participant
Power Participant

Problematic Many to Many Relationship - To many Rows

Can some please help.  I have 2 tables and created a relationship between the country coulmns, but as the relationship is many to many, getting to many rows in a table.

 

The table should look like this...

2020-09-11_10-53-15.jpg

 

but the Bi table is looking like this...

2020-09-11_10-53-28.jpg

 

I know this is down to the many to many, and have fumbled around with bridge tables, etc. but lack the knowledge\understanding and hoping someone can help.  

 

I have created a test pbix file, but unsure how to upload to here as cant see a file upload option, sharing via Dropbox link...

https://www.dropbox.com/s/zmicatnu01w7dan/test.pbix?dl=0

hopefully it will work and thanks in advance.

 

1 ACCEPTED SOLUTION

Might have found a solution to the many to many relationship issue producing multiple rows.  I have created a new uniqiue column in each table using...

 

Key = 'Carrier Matrix'[Region] & " - " & 'Carrier Matrix'[Country]& " - " & 'Carrier Matrix'[Carrier]
 
and this now created a 1 to many relationship and seems to work, although need to test before I get to excited.  Unless you can see an issue with this approach?

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@StuartSmith , you should create Country and region or country table and join that with both the tables. (Bridge Table)

 

Country = Distinct(union(all(Table1[Country]),all(Table2[Country])))

 

https://www.seerinteractive.com/blog/join-many-many-power-bi/

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

Thanks, I sort of managed to get it working, although i had to use the "Carrier" column from the "SIMs" table, which didnt feel right, although worked.

 

That said, as soon as I added another column, such as "Contract End Date" it doubled up the rows again.

2020-09-11_13-31-14.jpg Any ideas as this is so annoying, but I guess something so simply.  I have updated the file in dropbox.

https://www.dropbox.com/s/zmicatnu01w7dan/test.pbix?dl=0

 

Thanks in advance for your help.

Might have found a solution to the many to many relationship issue producing multiple rows.  I have created a new uniqiue column in each table using...

 

Key = 'Carrier Matrix'[Region] & " - " & 'Carrier Matrix'[Country]& " - " & 'Carrier Matrix'[Carrier]
 
and this now created a 1 to many relationship and seems to work, although need to test before I get to excited.  Unless you can see an issue with this approach?

@StuartSmith No, creating a key column is definitely the way to go if you can't merge the tables in Power Query for instance. Definitely try to avoid M2M relationships!! Either form a combo key column like you did or create a "bridge" table that contains unique values (in the even that you can'd do a combo key). I personally try to do a combo key first and then a bridge table second.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Cheers guys, the creation of the "Key" column on both tables seems to have fixed the issue and infact, actaully helped me identify columns on either table that had mis-matching values, such as typo's as they couldnt create a relationship between tables.  Once the typo's had been fixed or row content matched, duplicate columns vanished. Happy days. 

 

This has been a valuable learning lesson and after trying to fix the issue all week at work, the eurka moment actually came late Friday night, when I shouldnt have been working. 😀  

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.