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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

RLS not working

Third and last time I try to get an answer for this, I'm starting to think this is not even a thing!

 

I have applied row-level security for individual employees for a report by having a rule of Username = username() in my Dataset. 

The username column resembles what PowerBI recognises as =username() which is my employee ID and a company prefix.

 

I then publish the dataset to power bi online and created a report which points to the dataset.

When I view the report on power bi online, everything is blank. So the RLS has worked too well, and is not even showing me my data. 

 

I tried entering my email address into the security group on power bi online for the dataset, but this has no effect.

 

Am I missing a step somewhere?

4 REPLIES 4
Anonymous
Not applicable

I believe the issue arises when you upload your report to the service - at least if the Username is something like companyABC\User123.

 

The below link and quote describes the issue.

"Within the Power BI service, username() and userprincipalname() will both return the user's User Principal Name (UPN). This looks similar to an email address."

https://docs.microsoft.com/en-us/power-bi/service-admin-rls

 

You can try to troubleshoot it by making a USERNAME() measure just to see what the username should be equal to in your model.

 

If the above works then please mark it as the solution, kudos is also appreciated.

Anonymous
Not applicable

@Anonymous 

 

Yep I created a measure, then created a column that resembles that measure.

 

In the Modeling section when I add the rule Username = Username() <<< should it be Username = "Username()" ??? with the quotes or without?

Anonymous
Not applicable

It should be without quotes.

 

You should have something like this in the "Manage Roles" pop-up.

 

test.PNG

 

Is the security/Email in your facttable or do you have a seperate table with you emails which has a relation to the table?

  • If so then you should probably enable filtering both ways and Apply security filters in both directions if you have not already done so.
Anonymous
Not applicable

@Anonymous 

 

So the dataset has a few tables, some of which hold the username and some of which don't, and i've created joins/merges in Query Editor to get a single table which holds everything I need. All the tables come from the same SQL server though.

 

The relationship is two way between the source table and the new table. I tried having the report visualisations in the dataset and seeing if that works, but it doesn't. If I 'test as role' I see no data at all, whether I add my email address to the role or not.

But  I open the published Power BI Report I can see all of the data. I guess that's because I published it so it's ignoring the restrictions for me.

 

I have no idea what i'm doing wrong. 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.