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.
I am new to DAX and am trying to implement some dynamic RLS. The current table of users details looks like below:
User Email | User Name | Agent ID | Level of Access Required | Region | Company |
test@xxx.com | Test123 | 123 | Individual | USA | Company1 |
test@xxx.com | Test456 | 456 | Regional | UK | Company2 |
test@xxx.com | Test789 | 789 | National | AUS | Company3 |
What I want to do is give a user access at a level defined in 'Level of Access Required'.
This has 3 options:
1) National which will show all data for the specific company
2) Regional which will show all data for the specific company and the region
3) Individual which will show all data for user with the Agent ID
This table mentioned above will then be joined on to the other datasets within the report using a many to many join relationship I imagine?
Let me know if any further information is required.
Solved! Go to Solution.
sorry, was a bit quick there, you need to write it like this
VAR _t = CALCULATETABLE ( VALUES ( 'Access_Table'[Access_Required] ), FILTER ( 'Access_Table', 'Access_Table'[User_Email] = USERPRINCIPALNAME () ) ) RETURN IF ( CONTAINS ( _t, 'Access Table'[Access_Required], "National" ) || CONTAINS ( _t, 'Access Table'[Access_Required], "Regional" ), 'dimCompany'[Company] IN CALCULATETABLE ( VALUES ( 'Access_Table'[Company] ), FILTER ( 'Access_Table', 'Access_Table'[User_Email] = USERPRINCIPALNAME () ) ), TRUE () )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
85 | |
68 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |