Forum Discussion

jmkvalsund's avatar
jmkvalsund
Helper III
3 years ago
Solved

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="[email protected]"

 

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?

  • Anonymous's avatar
    Anonymous
    3 years ago

    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

1 Reply

  • Anonymous's avatar
    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