Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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

  • Anonymous's avatar
    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's avatar
      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's avatar
        Anonymous
        Not 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.