Forum Discussion
Multiple roles for one user
Hello everyone
I have defined two roles, which restrict access in two different dimensions respectively. E.g. 2017 in the time dimension and the customer 'XYZ' in the customer dimension.
When I selected both in 'View as Roles' I expected to see only the intersection (and logic of both conditions of both roles) of restricted sets, for example, only customer data 'XYZ' in 2017. Instead, I saw all the data.
How do multiple roles work for a user in general?
5 Replies
- nandukrishnavsCommunity Champion
Create a single role and add multiple filter conditions inside that.
If you want to add all the users into a single role and change the filter condition based on email id, please refer to this- https://community.powerbi.com/t5/Service/Dynamic-Row-Level-Security-Single-Role-for-all-the-User/m-p/643064
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂- parry2kSuper User
fbackes I have few blog post on RLS, check it here and there is one how you implement your business logic in RLS, hope it helps to implement your RLS logic.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
- LowerBRegular Visitor
Many thanks for your answer nandukrishnavs
>Create a single role and add multiple filter conditions inside that.
This is exactly what I finally did, but having multiple roles would be more elegant and easier to maintain, IMHO.
All the best
Frank
- v-alq-msftCommunity Support
Hi, fbackes
If you set two rules in two roles, the result will be the data filtered by rule one as well as the data filtered by rule two. If you want to get the intersection of two rules, you need to put two rules into one role with a "&&". I created data to reproduce your scenario.
Table:
Two rules in two roles:
CompanyLevel: [Company] = "C1" DepartmentLevel: [Department] = "A"Two rules in one role:
Conpamy&Department: [Department] = "A" && [Company] = "C1"Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.