Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Please can someone help with a row level security query.
I have the following tables
EntityA
User |
EntityB
Name | Icon |
A | Z |
B | Z |
C | X |
D | X |
F | C |
ZA | C |
I need to create a DAX formula to allow row level security for the following logic
If a user is not in Entity A table then the user should be restricted to see only records where Icon <> C. If the user is in Entity A then they will have access to all records in Entity B
.
Solved! Go to Solution.
@Anonymous
Ah, yes. Looks like it's the wrong way round.
VAR _User = USERPRINCIPALNAME()
RETURN
(_User IN EntityA )
|| ((NOT _User IN EntityA) && EntityB[Icon] <> "C")
.. here's the results
Thanks Paul.
Not sure if the above logic will work. I need to add the filter to the Entity B table in the Mangage Roles section.
Hi @Anonymous
You could use this in the RLS filter expression for EntityB
VAR _User = USERPRINCIPALNAME()
RETURN
(_User IN EntityA && EntityB[Icon] <> "C")
|| (NOT _User IN EntityA)
Be aware that USERPRINCIPALNAME() can give you a different result in Desktop that it does in PBI Service.
I'm receiving the following error:
The number of arguments is invalid. Function CONTAINSROW must have a value for each column in the table expression.
Is it because the User field is not specified in Entity A?
@Anonymous
Ah, yes. Looks like it's the wrong way round.
VAR _User = USERPRINCIPALNAME()
RETURN
(_User IN EntityA )
|| ((NOT _User IN EntityA) && EntityB[Icon] <> "C")
.. here's the results
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 13 | |
| 10 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 31 | |
| 28 | |
| 19 | |
| 11 | |
| 10 |