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
jmkvalsund
Helper III
Helper III

Saving USERNAME as a static value?

To avoid using RLS I've made some calculated tables filtering on

CamEmail=CurrentUser, and for the test setting CurrentUser="someone@mycompany.com"

 

Ideal I should now set CurrentUser=USERPRINCIPALNAME() but as you know that is not supported in calculated tables. 

Is there a way to store USERPRINCIPALNAME() as a static variable initiated when loading the report (as there are in most other languages)? And then set like CurrentUser=StaticVariabel?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @jmkvalsund ,

 

Yes, it is not possible to use the USERPRINCIPALNAME function in a calculated column or in a calculated table.

and, there are no native functions in Power Query that can do this.


Check the following threads to see if using measure to filter visuals meets your needs(Please replace USERNAME in the formula with USERPRINCIPALNAME). 

Solved: Error on using UserName() function in custom table

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @jmkvalsund ,

 

Yes, it is not possible to use the USERPRINCIPALNAME function in a calculated column or in a calculated table.

and, there are no native functions in Power Query that can do this.


Check the following threads to see if using measure to filter visuals meets your needs(Please replace USERNAME in the formula with USERPRINCIPALNAME). 

Solved: Error on using UserName() function in custom table

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

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