Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
11 | |
11 | |
10 | |
6 |