Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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 working in PowerBI service. I think powerBI service returns users email address instead of username. I am not sure why is happening but data is showing blank while testing using user's userName.
Do I need need to use Users Email address in my table to use in logic instead of username?.
Solved! Go to Solution.
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, username@contoso.com.
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, username@contoso.com.
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
Thanks @selimovd .
I too tested. need to Map users email-id only to implement RLS logic in PowerBI desktop to work similar in PowerBI service.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
82 | |
81 | |
52 | |
39 | |
34 |
User | Count |
---|---|
95 | |
78 | |
52 | |
49 | |
47 |