Forum Discussion
UserName() and UserprincipalName() in Dyanmic RLS
- 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
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
I need some help with this. I am using a sharepoint list where the people column in powerbi shows the username Last, First. I tried changing the sharepoint list to show the email address so I can do RLS with UserprincipalName(), but the change does not show in powerbi desktop. It still shows username Last, First. I would like to somehow get it to show the email so RLS will work on the powerbi service side. Thank you for your help