Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago

Create 2 RLS groups with different conditions

Hi.
there aree 2 tables - Sales & Manager, (from source i am getting sales table - Email column (with 2 or 3 Emails as a single row as per screenshot, Manager table have Email column as below)

when manager logis in he should see entire report data without any filters 
when sales team member login they should see only their data with RLS. How i can implement 2 RLS  roles(RLS , Non RLS )by uisng 2 tables ? Any help

 

8 Replies

  • Deku's avatar
    Deku
    Super User

    Should the manager see all data, or data for their team?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Deku manager should see full report  (manager data + Sales team data also = Entire report he should see  )

  • Deku's avatar
    Deku
    Super User

    Update the sales teams so single person per row. Add the sales tean table to the model and setup relationship using email.

     

    Add managers with no relationships 

     

    Add this to a RLS role on the sales table.

    Switch(

    True

    , USERPRINCPALNAME() in managers(), true,

    , USERPRINCPALNAME() = SalesTeam[email]

    )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Deku DAX is giving Syntax for List is incorrect error, when i applied RLS on Sales Table 
      Could you please help

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous ,

         

        Thank you for reaching out to Microsoft Fabric Community Forum.

        Deku Thank you for your quick response.

         

        Anonymous Please try the below DAX in the RLS role on the Sales table:

         

        SWITCH(
            TRUE(),
            USERPRINCIPALNAME() IN VALUES(Manager[Manager]), TRUE(),
            USERPRINCIPALNAME() = Sales[UserEmail]
        )
          

        If your problem has been solved already, please mark the helpful reply and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster .

        Thank you very much for your kind cooperation!

         

        Regards,

        B Manikanteswara Reddy