Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
hi guys
I am having some trouble with getting Dynamic RLS to work.
I have created a table with all Usernames that I have related to a table with usernames and costcenters. This table is then related to the Dim Costcentertable, which is related to the fact tables.
I have with some borrowing from Radacad put in a second dimension (SeeALL) which I use to overwrite the PrincipalName filter for some individuals who should see all cost centers.
In the RLS filter I have the following DAX code:
If(
MaxX(
Filter(
Users,
'Users'[Username]=USERPRINCIPALNAME())
,'Users'[SeeAll])=0,
max('Users'[Username])=USERPRINCIPALNAME(),
1=1
)
The main problem is that it is not working, users on the User list can't get access to see anything in the app.
Furtermore the testing in the desktop is not really working either. It seems to only acknowledge myself as a User and everybody else can see everything when I enter their username in "view as roles" function:
so why is the testing giving another result (see everything = no filter) than the app in the service (no access, see below:)
I have already tried to skip the above DAX code and just write:
Users[Username] = Userprincipalname() This gives me the same result.. which I find quite odd.
I have also been through a number of articles about dynamic RLS and also came across the following:
In this article a model is available. When I use that model I still can't get the testing to work.. no matter what user I filter in "view as role" it is not filtering anything.
What am I doing wrong?
Solved! Go to Solution.
I found the solution myself. I had two problems in the above. The Dax formula; I needed to take the MAX function out, so that it is now:
If(
MaxX(
Filter(
Users,
'Users'[Username]=USERPRINCIPALNAME())
,'Users'[SeeAll])=0,
'Users'[Username]=USERPRINCIPALNAME(),
1=1
)
Furthermore I found out that to check it in Desktop I needed to both check "Users" and "Other user"
Generally I find it a little frustrating that the documentation on RLS is mainly outdated and still explaining how to assign user on the web service. e.g.: https://docs.microsoft.com/da-dk/power-bi/service-admin-rls
..Anyhow.. it works now 🙂
I found the solution myself. I had two problems in the above. The Dax formula; I needed to take the MAX function out, so that it is now:
If(
MaxX(
Filter(
Users,
'Users'[Username]=USERPRINCIPALNAME())
,'Users'[SeeAll])=0,
'Users'[Username]=USERPRINCIPALNAME(),
1=1
)
Furthermore I found out that to check it in Desktop I needed to both check "Users" and "Other user"
Generally I find it a little frustrating that the documentation on RLS is mainly outdated and still explaining how to assign user on the web service. e.g.: https://docs.microsoft.com/da-dk/power-bi/service-admin-rls
..Anyhow.. it works now 🙂
I had this problem too. It turns out that I had my SeeAll column with 1's and 0's as a text field and since the DAX expression does not allow comparing Text value with Integer values it gives the error. Changing the SeeAll column to type Integer solved my problem.
Anybody?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
98 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |