Forum Discussion
How do i create a RLS role for 2 scenarios
I have a cost code column and a Email ID column. User should get the access of cost code against the email ID and in case of * against the email id user to should have access to all the cost code.
| Costcode | Email-ID |
| 12365 | [email protected] |
| 87907 | [email protected] |
| 26543 | [email protected] |
| * | [email protected] |
| 283920 | [email protected] |
[email protected] should have access to all the cost code.
Anonymous , refer if this can help
Power BI- Row Level Security: Handle ALL, UserPrincipalName: https://youtu.be/KVLEnIUo4pc
2 Replies
- amitchandakSuper User
Anonymous , refer if this can help
Power BI- Row Level Security: Handle ALL, UserPrincipalName: https://youtu.be/KVLEnIUo4pc
- jdbuchanan71Super User
I am assuming you are filtering another table that has data by cost code. You would apply a filter to that table by reading from the UserAccess table like this.
VAR _UPN = USERPRINCIPALNAME() RETURN IF ( LOOKUPVALUE ( UserAccess[Costcode], UserAccess[Email-ID], _UPN, UserAccess[Costcode], "*" ) = "*", TRUE, 'Table'[CostCode] = LOOKUPVALUE ( UserAccess[Costcode], UserAccess[Email-ID], _UPN, UserAccess[Costcode], 'Table'[CostCode] ) )I have attached my sample file for you to look at. You can test the RLS by using View As on the modeling ribon
You can see that bgy can see all rows:
but bcd can only see the subset he is assigned to