Forum Discussion

Ben1981's avatar
Ben1981
Helper III
9 months ago
Solved

RLS based on CONTAINSSTRING?

Hi, Is there a way with RLS to filter a column based on if a value is contained within a string?  I have two tables setup, HR People and HR Hierarchy, no connected to each other but can be via ...
  • pankajnamekar25's avatar
    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