Forum Discussion

pedroccamara's avatar
pedroccamara
Helper II
10 years ago
Solved

Relate same table twice

Hello

I have a problem and still don't know how to solve it.

The main db has two fields with the same data. It is a username of the person whatever. And i have another db that has all usernames and their names. I just want to show their names in both cases. It means, i think, i had to creat a relation from de 2nd db to the first db, twice. I'm not sure if this is possible. Is it?

Tks

Pedro

  • v-haibl-msft's avatar
    v-haibl-msft
    10 years ago

    pedroccamara

     

    We cannot make two relationships active at the same time for two tables here. Using an inactive relationship is a way. This article should be a good reference.

    Actually, we don’t need two relationships in some situations. As dejanle posted above, if we have two tables as below. We can create a relationship between Sell-to_Customer_No and Customer_No to get Sell-to Custome_Name.

     

    We can also get Bill-to_Customer_Name by creating a column using LOOKUPVALUE without relationship.

    Bill Customer Name = 
    LOOKUPVALUE ( DB2[Customer_Name], DB2[Customer_No], DB1[Bill-to_Customer_No] )

     

    Best Regards,

    Herbert

11 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    pedroccamara Can you provide an example? Are you going to import the data or use a different connection type like direct query to these sources? If you import the data into Power BI Desktop, there are a bunch of ways you can merge, clean up your data set to display how you want it.

    • pedroccamara's avatar
      pedroccamara
      Helper II

      Hello Eno and many thanks for your help.

      The problem is that i have 2 identical fields from a table. Both are showing usernames and i have a table to relate to both. Power bi "said" i can't do it. Either one field or the other. Not both. My question, cose i'm running out of ideas, how to do it in other way?

      Many thanks

      Best regards

      Pedro

  • v-haibl-msft's avatar
    v-haibl-msft
    Microsoft Employee

    pedroccamara

     

    Not sure how do you want to show their names. But I think you can create an active and an inactive relationship between two tables.

    Please refer to this document.

     

    Best Regards,

    Herbert

    • pedroccamara's avatar
      pedroccamara
      Helper II

      Hello Herbert and many thanks for your reply

      The problem with your solution is that i don't want to determine wich relation has priority above the other.

      Tey are both important to me.

      But i think i have to work it in other way. Don't know how since the table is design like this. Maybe duplicating a table....but that can be "dangerous".

      Anyway. Tks a lot.

      Brest regards

      Pedro

      • Anonymous's avatar
        Anonymous
        Not applicable

        pedroccamara You providing a sample of what your issue is will go a long way in helping us determine a solution. Just throw down some sample data...

        Does your scenerio look something like this?

         

        DB1                           DB2

        Username                  Username     Name

        suser                          suser             sample user

        tuser                          tuser              test user