The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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])
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
68 | |
37 | |
21 | |
18 | |
15 |
User | Count |
---|---|
124 | |
39 | |
30 | |
24 | |
22 |