Forum Discussion
RLS based on CONTAINSSTRING?
- 9 months ago
Hello Ben1981
try with this DAX code
In your RLS role definition (for table 'Dim HR Hierarchy')VAR _UserID =
MAXX(
FILTER('Dim HR People', 'Dim HR People'[Email] = USERPRINCIPALNAME()),
'Dim HR People'[ID Key]
)
RETURN
CONTAINSSTRING('Dim HR Hierarchy'[Path], _UserID)
If my response helped you, please consider clicking
Accept as Solution ✅ and giving it a Like 👍 – it helps others in the community too.
Thanks,
Connect with me on:
LinkedIn
Hello Ben1981
try with this DAX code
In your RLS role definition (for table 'Dim HR Hierarchy')
VAR _UserID =
MAXX(
FILTER('Dim HR People', 'Dim HR People'[Email] = USERPRINCIPALNAME()),
'Dim HR People'[ID Key]
)
RETURN
CONTAINSSTRING('Dim HR Hierarchy'[Path], _UserID)
If my response helped you, please consider clicking
Accept as Solution ✅ and giving it a Like 👍 – it helps others in the community too.
Thanks,
Connect with me on:
Hi, so this seems to work when I view role as me but if I try view as other and put in the login details for another user then it doens't work.
So not sure if it's because of the view as other isn't working right because of the details I've inputted or if the code above does not work?