Forum Discussion
RLS to show certain data based on condition
Hello everyone!
I've been struggling to create a RLS rule that shows a supervisor X data from manager Y. The problem is, I only have supervisor X's e-mail(no data beyond this single e-mail), which it's not even related to manager Y (this one has real data from stores etc), yet I have to show the data somehow. I thought of doing something like if username() = xxxx@xxxx then it should show everything from table stores related to manager Y. Is it even possible to do that? If it is, what DAX should I be using?
Thanks in advance!
I would use some thing like this:
IF( USERPRINCIPALNAME() = email of the supervisor x, email of manager Y, USERPRINCIPALNAME()
)
If you put this measure on the rls table and this table has a relationship to fact table the RLS should bem work as you're looking for.
Let me know if ir works.
5 Replies
- _AAndradeResident Rockstar
In order to provide a right answer it's important to know how your model is working and the tables you are using to implement RLS.
Please provide more information.- AnonymousNot applicable
I have 4 tables, one fact, 3 dimensions, one has data that will be used for RLS, the other is a calendar and the last one has store characteristcs. I just need to show data from the fact table based on this RLS rule. The problem is, the person that this rule is based of doesn't have any data that relates them to the fact table.
- _AAndradeResident Rockstar
I would use some thing like this:
IF( USERPRINCIPALNAME() = email of the supervisor x, email of manager Y, USERPRINCIPALNAME()
)
If you put this measure on the rls table and this table has a relationship to fact table the RLS should bem work as you're looking for.
Let me know if ir works.
- AnonymousNot applicable
I went along your train of thought and it worked out with this:
RELATED('tb_rls'[login]) = "manageremail" && USERPRINCIPALNAME() = "supervisoremail"- _AAndradeResident Rockstar
Hi Anonymous,
Did it solve your problem?
Did my message help you in any way? If it did, please mark my message as the solution and give it a "kudo", I'll appreciate it and help me out