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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
prakash11440278
Post Prodigy
Post Prodigy

How to make relationship between two tables both having duplicate records

Hi All,

Can some body please explain how to make relationship between two tables, that two tables all contain duplicate records. Which it is not possible to relate due to duplicate records presents in both tables. Please explain how to relate the both tables in relationship tab.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @prakash11440278,

 

In order to create this visualisation now you should use the "customer" field from the new table you created.

 

 

Best,

Kris

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @prakash11440278,

 

In order to create your relationship you should first create a table that contains all the unique values from the columns that you wish to create the relationship on. I've assumed both tables have a column called Customer. Create a new Table using the measure

 

Customers = DISTINCT(UNION
     (SELECTCOLUMNS(Table1,"Customer",[Customer]),
     SELECTCOLUMNS(Table2,"Customer",[Customer])))

 

This measure will create a union of the 2 customer columns and then remove all duplicates leaving you with all your distinct customers. You can then create a relationship in the relationship window as follows

 

Capture33.PNG

 

Alternatively (this would be my prefered method), if you wished to do this in the query editor, you could append the 2 tables that you require to relate (as a new query) and keep only the column you wish to create a relationship on.  A quick removal of duplicates and you have your distinct customer table. You can then create the relationship as above.

 

Hope this helps.

 

Regards,

Kris

Very helpful and clear!!

Alternatively (this would be my prefered method), if you wished to do this in the query editor, you could append the 2 tables that you require to relate (as a new query) and keep only the column you wish to create a relationship on.  A quick removal of duplicates and you have your distinct customer table. You can then create the relationship as above.

does not work i tried. 

Harsha

Hi kriscoupe,

 

Thanks for your reply.

 

I created new a table, as suggested below. Still the issue remains same. Please find the attached screen shot.

 

image.pngimage.pngimage.png

Anonymous
Not applicable

Hi @prakash11440278,

 

In order to create this visualisation now you should use the "customer" field from the new table you created.

 

 

Best,

Kris

Hi kriscoupe,

 

This worked. Thanks....:)

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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