Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Can we test a measure's value in our RLS?

We have a question about using the value of a measure in our RLS. I thought we had this working, but now we see that the RLS is ignoring the measure and always returning all rows.

 

Specifically, we have a calculation that determines whether a user has access to a report based on the username and whether that user has an entry in a security table. Then we have a data table with this RLS code:

     myMeasures[Report_Access] = True

 

What we see is that even when the measure Report_Access is calculated as False, the user still is able to see all of the rows in the table. (Our intent though is to block all access when this value is False and only let them see all rows when the value of Report_Access is True.)

 

All I can think of is that RLS only lets measures to be used on the right-side of the equal sign; it doesn't really let us test the value of a measure because that measure is not a column/field in the dataset. Is that correct? And if so, is there a workaround?

We tried a workaround:

    MyMeasures[Report_Access] = True && (User_Status = True || User_Status = False) 

where User_Status is a field in the dataset with only True & False values. We were hoping that this would force Power BI to perform the calculation on each row. But it still seems that the test on Report_Access is being ignored.

 

Any ideas?

 

Chuck

8 Replies

  • sturlaws's avatar
    sturlaws
    Icon for Resident Rockstar rankResident Rockstar

    Hi Anonymous 

     

    have you created a default role? Have you added you measure to the filter of each table for that role?

     

    Cheers,
    Sturla

    • Anonymous's avatar
      Anonymous
      Not applicable

      I'm sorry; I'm not sure I understand your questions.

       

      The measure I'm testing is Report_Access. 

      This report has five tables, but the visual I'm looking at is using one of the tables. We have the security on that table as

          MyMeasures [Report_Access] = True

       

      Report_Access is not a column in the data table. 

       

      I don't think I've answered your questions, have I?

      I'm not familiar with setting up default roles.

      • Anonymous's avatar
        Anonymous
        Not applicable

        And what's crazy is I'm looking at the documentation I made back in March. I'm getting different results now than what I got a few months ago.