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
prakash11440278
Post Prodigy
Post Prodigy

Dynamic RLS using Userprinciplename()

Hi Power BI Experts,

I observed a strange issue in dynamic RLS where i added employee mail id in desktop level using userprinciplename() dax function. It is working fine for few mail id for example "xyz@company.com" but in our client organization we have different mail id's are there for example "xyz@company.onmicrosoft.com" & "xyz@company1.company.com". Here what is happening is i am able to see the proper data for xyz@company.com but i am not able to see other mail id's data for different employees("xyz@company.onmicrosoft.com" & "xyz@company1.company.com"). What function i need to use for this mail id employees i have used userprinciplename() function for my development. Please suggest. Thanks.

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@prakash11440278 

You need to first define the username names (Emai IDs) that the users will use to connect to the Power BI service. 
"You can use username() within this expression. Be aware that username() has the format of DOMAIN\username within Power BI Desktop. Within the Power BI service and Power BI Report Server, it's in the format of the user's User Principal Name (UPN). Alternatively, you can use userprincipalname(), which always returns the user in the format of their user principal name, username@contoso.com."

Please refer help as well: https://docs.microsoft.com/en-us/power-bi/admin/service-admin-rls#:~:text=Within%20Power%20BI%20Desk...).



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@prakash11440278 

You need to first define the username names (Emai IDs) that the users will use to connect to the Power BI service. 
"You can use username() within this expression. Be aware that username() has the format of DOMAIN\username within Power BI Desktop. Within the Power BI service and Power BI Report Server, it's in the format of the user's User Principal Name (UPN). Alternatively, you can use userprincipalname(), which always returns the user in the format of their user principal name, username@contoso.com."

Please refer help as well: https://docs.microsoft.com/en-us/power-bi/admin/service-admin-rls#:~:text=Within%20Power%20BI%20Desk...).



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy ,

Thanks for your reply.

You mean to say i need to use the username() function instead of userprinciplename() function?

I have used email=userprinciplename() expression in my model and this one not working because of different mail id's what i showned in above. How to handle this situation?

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.

Top Solution Authors