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

Cannor create relation between 2 tables

I have 2 tables:  Emp and Org. I need to create a relation between these 2 tables with the column "USERID" in both the tables.

 

However, both of them have duplicate values which i cannot remove. What's a way to create a relation between the 2?

 

I tried creating an intermediate table with duplciates removed, but i guess data is lost in that process.

 

Any way to achieve this without data loss? Thank you!

4 REPLIES 4
Greg_Deckler
Super User
Super User

Table = DISTINCT(UNION(VALUES('Table1'[Some Column]),VALUES('Table2'[Some Column])))

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
BobBI
Resolver III
Resolver III

Creating an intermeidate table is the solution.

 

if you have User ID field available in both tables ( Emp  & Org) , then copy Emp Power query and stripout all the column ( only keep User ID) , Remove Duplicate and then connect both table to this new table with  M:1:M relationship .

 

Capture2.JPG

You won't loose any data.

 

Hope this helps

SS

Anonymous
Not applicable

@BobBI @Greg_Deckler Hey i take the USER ID from the Emp table, remove duplicates and form the relation. (Tried both the suggestions)

 

Then, when I need to create a measure that involves the Emp and Orf table it says:

 

Merge error.PNG

 

Make sure that your filter direction goes from your intermediate table towards your "fact" tables. And possibly bi-directional. Make sure that you use UserID from your intermediate table. What columns are you trying to put into a visual?


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.