Forum Discussion
RLS does not work
The data I have I get from AD. It's a default table which I've added some columns to
| User | Manager | Id | Manager ID | Login | Org Level 1 | Org Level 2 | Org Level 3 | Path | Path User |
| A | B | 1 | 2 | [email protected] | [email protected] | [email protected] | [email protected] | 3|2|1 | A|B|C |
| B | C | 2 | 3 | [email protected] | [email protected] | [email protected] | 3|2 | B|C | |
| C | 3 | [email protected] | [email protected] | 3 | C |
But when I add RLS it just does not work.
If I view the role as 'User' I only can see myself (User B), not the people below me.
If I view the role as 'Other User' it does not matter what I put in there, I still can see everyone. There is just no filtering on the user table.
I've tried the following dax codes in my RLS user table:
PATHCONTAINS(
User[Path User],
LOOKUPVALUE(
User[User],
User[Login],
USERPRINCIPALNAME()
)
)
-----------------------------------------------------------------------------------------------------------------------------------------------
PATHCONTAINS(User[User],
MaxX(
Filter(
User,
[Login]=USERPRINCIPALNAME()
)
, User[User]
)
)
-----------------------------------------------------------------------------------------------------------------------------------------------
VAR Agents =
CALCULATETABLE (
VALUES ( 'User'[User] ),
'user'[Manager] = USERNAME())
RETURN
IF('Agent name'[login] IN Agents, TRUE, FALSE)
-----------------------------------------------------------------------------------------------------------------------------------------------
LOOKUPVALUE(
User[User],
User[User],
RIGHT(USERNAME(), USERNAME())
-----------------------------------------------------------------------------------------------------------------------------------------------
[Login] = USERPRINCIPALNAME()
|| [Org Level 3] = USERPRINCIPALNAME()
|| [Org Level 2] = USERPRINCIPALNAME()
|| [Org Level 1] = USERPRINCIPALNAME()
With all I have the same result
3 Replies
- amitchandakSuper User
Anonymous , Refer if this can help
https://www.blue-granite.com/blog/using-dynamic-row-level-security-with-organizational-hierarchies
- AnonymousNot applicable
Hi amitchandak Thank you for the link, unfortunaly I've already tried his solution which also did not work (see last dax query)
- v-diye-msftCommunity Support
Hi Anonymous
Kindly check below blog whether helps:
https://radacad.com/dynamic-row-level-security-with-manager-level-access-in-power-bi
https://radacad.com/dynamic-row-level-security-with-organizational-hierarchy-power-bi