PowerPivot many-to-many relationships

lovallee

Board Regular
Joined
Jul 8, 2002
Messages
220
Good day

My data lies in Table1 and Table2 as follow.
"Users" are assigned several "Roles" and each "Role" give authorization to several "TCodes".
This is a many-to-many relationship, which cannot directly be handled via PowerPivot relations.
Which Calculated Measure (DAX) will allow me see which "TCodes" are assigned to which "Users"? (i.e. a pivot table with fields "Users" and "TCodes" and a value where the TCode is effectively assigned to the User)

Thanks!

Table1
User Role
User1 Role1
User1 Role2
User1 Role3
User2 Role2
User2 Role3
User2 Role4
User2 Role5


Table2
Role TCode
Role1 TCode1
Role1 TCode2
Role2 TCode2
Role2 TCode3
Role3 TCode4
Role4 TCode4
Role5 TCode5
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I found a solution thanks to: A mystifying and awesome solution for many 2 many - PowerPivotPro PowerPivotPro

1) Field "Role" being the common field to the many-to-many relation, I needed to create a 1-field table listing each role (JustRole table).
2) Create a relation between Table1 and JustRole
3) Create a relation between Table2 and JustRole
4) Add calculated measure: =CALCULATE(COUNTA(Table2[TCode]),Table1)

That's it!
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,365
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top