Forum Discussion

dancarr22's avatar
dancarr22
Helper V
1 year ago
Solved

Applying Row Level Security using LIKE

Hello,   We have RLS (row level security) set up on our data model and it is working properly. But, we have a new request which I need assistance with: how do you set up RLS for a table where we a...
  • rohit1991's avatar
    1 year ago

    Hi dancarr22 ,

    Thanks for reaching out. You're correct that the STARTSWITH function isn't supported directly in the DAX expression editor within the "Manage Roles" interface for Row-Level Security. However, you can achieve the same functionality using the LEFT function or the SEARCH function in combination with a logical comparison.

     

    For your use case, a simple workaround would be to use an expression like LEFT([DeptID], 2) = "HR", which effectively mimics the STARTSWITH behavior. Alternatively, you can use SEARCH("HR", [DeptID], 1, 0) = 1, which checks if "HR" appears at the beginning of the DeptID field. Either of these approaches should allow you to implement the desired RLS rule based on prefix filtering. Let me know if you need help applying this in your specific model.