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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
AdamGSmith
Frequent Visitor

Dynamic Row Level Security not filtering correctly

Hi community, 

 

Please can someone help as I'm really stuck with dynamic row level security. I had a solution that was working correctly but now isn't and I can't figure out why. I decided to go back to the basics and I can't get this working either. What am I doing wrong? Or is it a bug?

 

In a new desktop file I have entered data to define the following table:

AdamGSmith_0-1698131699412.png

I created a measure to lookup the current user:

AdamGSmith_1-1698131740078.png

 

As you can see this works correctly in the report view.

AdamGSmith_2-1698131755314.png

 

I then defined the row level security role with the same expression as the measure:

AdamGSmith_3-1698131781549.png

 

But when I view as another user the row level security is applied but the user can not see their own record, so it appears to filter the entire table rather than down to the records that match. 

AdamGSmith_4-1698131817368.png

If my understanding is correct the user should see their own record here. The data model only contains the one table, so there are no relationship to propagate filters to other tables. 

 

Please help! 

 

I am using the latest power bi desktop updated from the store. 

AdamGSmith_5-1698132089436.png

I also tried disabling and reenabling the enhanced row-level security editor in preview features. 

 

Many thanks

 

Adam

1 ACCEPTED SOLUTION
HughLa
Resolver IV
Resolver IV

Hi @AdamGSmith 

 

Have you tried removing the "" around USERPRINCIPLENAME() in your rule? That means you are litterally searching for the string USERPRINCIPLENAME().

 

Let me know if that works.

Hugh

 

View solution in original post

2 REPLIES 2
HughLa
Resolver IV
Resolver IV

Hi @AdamGSmith 

 

Have you tried removing the "" around USERPRINCIPLENAME() in your rule? That means you are litterally searching for the string USERPRINCIPLENAME().

 

Let me know if that works.

Hugh

 

Thank you so much @HughLa, that's done it. 

AdamGSmith_0-1698134140954.png

Now, the question is how did the quotation marks appear?

Well after I created the rule and selected table and column to filter, pbi automatically puts in and expression for you. 

AdamGSmith_1-1698134279406.png

AdamGSmith_2-1698134287335.png

I've then typed the function inside the quotation marks, a very silly mistake to make. 

 

Thanks again @HughLa. Hopefully I can fix the other solution now. 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.