Forum Discussion
RLS not working
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.
- Anonymous6 years agoNot 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?
- Anonymous6 years agoNot applicable
It should be without quotes.
You should have something like this in the "Manage Roles" pop-up.
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.
- Anonymous6 years agoNot 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.