Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

UserName() and UserprincipalName() in Dyanmic RLS

Hello,   I have User table that contains username. And I have used that username to implement dynamic RLS. its works fine with desktop with Username() or UserprincipalName().    But it not worki...
  • selimovd's avatar
    5 years ago

    Hello Anonymous ,

     

    yes, your guess is right. 

    In Power BI Service both Username() and UserprincipalName() return the e-mail address.

     

    See the notice from the row level security documentation:

     

    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, [email protected].

     

     

    So you should change the table to the e-mail address and use UserprincipalName() already in Power BI Desktop to make the report work on both platforms in the same way.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍

    Best regards
    Denis

    Blog: WhatTheFact.bi