Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
DiKi-I
Post Partisan
Post Partisan

Row level security help

Can I use username() for row level security instead of userprincipalname(). I have ad user name in the table but not user email. Could you please let me know if this will work. Also my table is in direct query mode so I won't be able to modify the data.

1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

yes this approach also works

 

just to be sure that the name your have in the table is in the right format

Create a measure _Test = Username()

 

Then add this measure in a card, to see how it is formatted vs what you have in the table (maybe you will have to add the domain in the list)

View solution in original post

7 REPLIES 7
v-csrikanth
Community Support
Community Support

Hi @DiKi-I 

We haven't heard from you since last response and just wanted to check whether the solution provided has worked for you. If yes, please Accept as Solution to help others benefit in the community.
Thank you.


If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

Hi @DiKi-I 
I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions?
If your issue is resolved, please consider marking the post as solved. However, if you're still facing challenges, feel free to share the details, and we'll be happy to assist you further.
Looking forward to your response!

Best Regards,
Cheri Srikanth

v-csrikanth
Community Support
Community Support

Hi @DiKi-I 
It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered?
If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!
Looking forward to your reply!

If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth.

v-csrikanth
Community Support
Community Support

Hi @DiKi-I 

In addition to @Idrissshatila @Cookistador below additional suggestions for implementing Row-Level Security (RLS) in Power BI.

  • Dynamic RLS using USERNAME() or USERPRINCIPALNAME(): Store user-to-data mappings in a table and filter based on the logged-in user dynamically.
  • Using security groups: Assign roles via Azure AD security groups and filter data based on group membership.
  • Testing RLS using "View as Role": Always validate roles in Power BI Desktop before publishing.
  • Combining static and dynamic RLS: Use hybrid logic for more complex access control scenarios.


If the above information is helpful, please give us Kudos and mark the response as Accepted as solution.
Best Regards,
Community Support Team _ C Srikanth.

 

Idrissshatila
Super User
Super User

Hello @DiKi-I ,

 

make sure to test it in the view role before applying it, since this is a sensitive case.



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




my username is getting resolved to upn in service. I will test with the actual data once I have gateway setup.

Cookistador
Super User
Super User

yes this approach also works

 

just to be sure that the name your have in the table is in the right format

Create a measure _Test = Username()

 

Then add this measure in a card, to see how it is formatted vs what you have in the table (maybe you will have to add the domain in the list)

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors