Forum Discussion

tomperro's avatar
tomperro
Icon for Helper V rankHelper V
2 years ago
Solved

Pre-Select Slicer Based on User

Is there a way to pre-select slicers based on the logged in user?
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi tomperro 

    You can use pre-slicer visual and rls, you can refer to the following example.

    Sample data 

    Goal: Based on the user to pick the biggest number in advance

    1.Create a user table.

    2.Add the pre-slicer visual to the desktop.

    3.Add a true/false table

    4.Create a relationship among the user table and the data table.

     

    5.Create a measure.

    Measure =
    VAR a =
        MAXX ( ALLSELECTED ( 'Table (2)' ), [Column2] )
    RETURN
        IF ( SELECTEDVALUE ( 'Table (2)'[Column2] ) = a, TRUE (), FALSE () )
    

    Then put the following field to the pre-slicer.

     

    6.Create a new role in RLS in user table.

    [useraccount]=USERPRINCIPALNAME ()

     

    7.Test the role.

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.