Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello!
I'm trying to set up some kind of custom dynamic RLS. Basically, I want some people to see the report as their bosses. And for that I need to change the value of their userprincipalname() with another value.
A have a table with the real login and the new, fake login that they should see the report as. The reason why I need such a complicated desicion is that bosses can only see their department, usually employees can't see this info, but some request it specifically. For some people the new_login is the same as they don't need to have additional permissions.
real_login | new_login |
boss | boss |
employee1 | employee1 |
employee2 | boss |
I am very new to DAX and I really struggle to understand how I can create a RLS rule where I compare the UPN with one value and replace it with another one at the same time. I was thinking about something like:
[real_login] = SWITCH(USERPRIPCIPALNAME(), [real_login], [new_login], 0)
But it doesn't seem to do the job. I will appreciate any help and thanks in advance.
Solved! Go to Solution.
@Oksie , Try a new measure like
maxx(filter(Table, Table[real_login] =USERPRIPCIPALNAME()) , [new_login])
Hi @Oksie ,
According to your description, if boss login, he will see information of boss and employee2. If employee1 login, he will see information of himself. If employee2 login, he will see nothing.
If this is the case, here's my solution.
[new_login] = USERPRINCIPALNAME ()
Then the real_login column connect to other fact tables.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Oksie ,
According to your description, if boss login, he will see information of boss and employee2. If employee1 login, he will see information of himself. If employee2 login, he will see nothing.
If this is the case, here's my solution.
[new_login] = USERPRINCIPALNAME ()
Then the real_login column connect to other fact tables.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Oksie , Try a new measure like
maxx(filter(Table, Table[real_login] =USERPRIPCIPALNAME()) , [new_login])
User | Count |
---|---|
53 | |
28 | |
19 | |
18 | |
14 |
User | Count |
---|---|
92 | |
86 | |
39 | |
23 | |
22 |