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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 9 | |
| 9 | |
| 8 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 23 | |
| 16 | |
| 15 | |
| 14 | |
| 8 |