Forum Discussion

aid928's avatar
aid928
Helper I
3 years ago
Solved

Relationship between two tables based off multiple columns?

Hi all,

 

Hoping someone can help me with this one as it's really got me stuck.

 

Basically I have four tables. One table is a Cost Centre hierarchy, with high level codes feeding into lower level codes (L5 is a bottom level Cost Centre).

 

L1L2L3L4L5
112123123412345
112123123412333
112123123912392
115154154415448
222224224822482

 

Two other tables are Account Code and Activity coce hierarchies with a similar layout to the above.

 

I then have a Posting Rules table, where a Posting Rule can exist at any level in the hierarchy.

 

CCACCACT
1xyy
1xxyy
12345xyy
2248xxxyy
2248xxyy
22xxyy

 

Having real difficulty getting these tables linked. Even just focusing on the Cost Centre table, because a Posting Rule can sit at any level in a hierarchy, I'm not able to build a relationship between single columns.

 

We essentially want a user to be able to select a bottom level (L5) Cost Centre from a slicer (say 12345), and then see all Posting Rules directly against it, or that feed up through the hierarchy, so this would produce:

 

CCACCACT
1xyy
1xxyy
12345xyy

 

Any help to come to this solution would be greatly appreciated.

 

Thanks!

10 Replies

  • Hi tamerj1,

     

    Thanks very much for producing this - I tried downloading the file but because we are on Power Bi Report Server and your file has many-to-many relationships, I'm unable to open it.

     

    Are you able to explain how you linked the two tables together?

     

    Thanks so much

    • tamerj1's avatar
      tamerj1
      Community Champion

      aid928 
      From the model view just drag the CC from table to the other CC in the other table.

      • aid928's avatar
        aid928
        Helper I

        Hi tamerj1 

         

        Thanks again for explaining this, really useful for understanding.

         

        Do you know if there would be any way to achieve this without a many to many relationship? Since we are on PBI Report Server I can't make a many to many relationship.

         

        Thanks,

         

        Aidan