I think I might have stumbled upon a bug with Row Level Security.
My data source is SQL Analysis Services, which I am importing (NOT CONNECT LIVE).
As per below please note that I have added Anthony Terblanche to the particular role that I am testing. I also added him as a viewer of the particular workspace. I click on "Test as Role" to see whether RLS is working smoothly.
As per below, I can only see one Salesperson's data (as expected)
I do another test "Now Viewing as: Anthony Terblanche(My test user)"
Still it is working as expected.
But, when I start editing my Workspace or editing the RLS something breaks. For example I changed his access to the workspace to Member
Removed him from the Role (under Security), added him again, and now the role just does not work anymore. It works when I view as the role, but not when I select "Viewing as Anthony Terblanche". I have asked the user to test from his side, and he experiences the same.... In the 1st example above, he could only see one Salesperson's data, but after making a few changes, he can see all data.
No matter what I try, I can not get this to work again. I have removed him from the workspace, re-added him as a viewer, re-added him to the role,but nothing helps. Basically the workaround is to create a new workspace, publish the report to the new workspace, and then add users to the roles, and not making any mistakes or editing anything.
If this is not a bug, and there is something I am doing wrong, kindly advise.
I followed your description to reproduce the problem. Just to be clear with you, RLS will only work if you are the viewer of the workspace and are added to RLS roles (if you have edit permissions, then you will be able to see everything).
I did have the problem you describe briefly like below, but I found that if I waited 15-30 minutes, my RLS worked fine. This seems to be due to a delay in operation.
1. Configure RLS for the report on Power BI Desktop, set the Rules to [Year]=2021. Then publish the report to Power BI Service.
2. In Dataset>Security>Members, add user A (A is already a member role of workspace), save it and click Test as Role.
Then do two different operations 1. Exit the Role page, change user A to Viewer in workspace and reopen the report with user A's account.
2. In Dataset>Security>Members, remove User A and re-add it to the RLS role. Reopen the report with account A.
Operations in Power BI, which theoretically take a certain amount of time to take effect, will react for different lengths of time depending on the situation. Sorry for the inconvenience.