Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

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

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion
    Table = DISTINCT(UNION(VALUES('Table1'[Some Column]),VALUES('Table2'[Some Column])))
  • BobBI's avatar
    BobBI
    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 .

     

    You won't loose any data.

     

    Hope this helps

    SS

    • Anonymous's avatar
      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:

       

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        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?