Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Oksie
Regular Visitor

Is it possible to change the value of USERPRINCIPALNAME?

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_loginnew_login
bossboss
employee1       employee1
employee2boss

 

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.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Oksie , Try a new measure like

 

maxx(filter(Table, Table[real_login] =USERPRIPCIPALNAME()) , [new_login])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

v-yanjiang-msft
Community Support
Community Support

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 ()

 

vkalyjmsft_0-1645516750346.png

Then the real_login column connect to other fact tables.

vkalyjmsft_1-1645517144455.png

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.

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

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 ()

 

vkalyjmsft_0-1645516750346.png

Then the real_login column connect to other fact tables.

vkalyjmsft_1-1645517144455.png

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.

amitchandak
Super User
Super User

@Oksie , Try a new measure like

 

maxx(filter(Table, Table[real_login] =USERPRIPCIPALNAME()) , [new_login])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.