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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors