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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Bridge Table to bypass Many-to-Many Problem

Hello community, I am hoping you can help me. 

I have one column in Table A with part numbers, all unique except for a string of 0's afterwards. Those zero's are there because in the source data there is room so that if a new part number is added, it will overwrite that 0. 

I have one column in Table B with part numbers, this time duplicating because they represent each shipment the part number is on. 

 

I want to create a relationship between these two tables on the part number column, but since i need the 0's incase new part numbers are added (this is an autonomous report) it will not let me do so since neither column has a unique number. 

I am trying to create a bridge table, but am stck. I want to have a new table that combines part numbers from table A and table B, removing any duplicat values leaving me one table that i can then use to create a relationship with. 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check if this is what you want:

1. Create a calculated table.

Bridge Table =
DISTINCT (
    UNION ( VALUES ( 'Table A'[Part Numbers] ), VALUES ( 'Table B'[Part Numbers] ) )
)

bridge.PNG

 

2. Create relationships.

bridge2.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Icey
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem solved?

 

 

Best Regards,

Icey

Icey
Community Support
Community Support

Hi @Anonymous ,

 

Please check if this is what you want:

1. Create a calculated table.

Bridge Table =
DISTINCT (
    UNION ( VALUES ( 'Table A'[Part Numbers] ), VALUES ( 'Table B'[Part Numbers] ) )
)

bridge.PNG

 

2. Create relationships.

bridge2.PNG

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PaulDBrown
Community Champion
Community Champion

@Anonymous
In Power Query, Create new tables from each by referencing them, remove all columns except the relevant, append both new tables, remove duplicates, load and create the relationships




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.






Anonymous
Not applicable

Hi @ImkeF - Since both Table A and B contain duplicates... the bridge table would display all part numbers and the one 0 with no duplicates. 

 

That way Table A can have a relationship with Bridge table and, 

Table B can have a relationship with the Bridge Table. 

 

hi @PaulDBrown I will try that, thanks!

@Anonymous
Before you append the new tables, make sure both columns have the same name (sorry, I forgot to mention that)




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.






ImkeF
Super User
Super User

 

Hi @Anonymous  

could you please post (link to) sample data?

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

 

I cannot post the actual data, but here is an example. 

 

 

2020-02-21_14h51_53.png

Thanks, but I still don't understand the logic. How should your bridge-table look like / where's the many-2-many here?

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.