Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

RLS / Multiple Categories

Hi All,

 

Im trying to figure out this dynamic RLS problem that i have. I want a simple RLS User table to filter allowed content using USERPRINCIPLENAME(). 

 

Example: In the case of [email protected] user should be seeing data only related to the following criteria: 

Peru/Finland/BU1/BU2/EPC

 

RLS User Table

 

Data Table

 

Anyone has an idea of how to acomplish this? 

 

Thanks in advance for any possible help. 

Kr

 

6 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Pragati, Thanks for sharing the link. No, i have tried and i can not det it to work. I have seen this post before. Any more ideas on how to accomplish? 

  • v-diye-msft's avatar
    v-diye-msft
    Community Support

    Hi Anonymous 

     

    If there's relationship exited between RLS User Table and Data table and assuming the related column is A in RLS table, B in Data table, you should specify the related column in the DAX expression such as:

     

    [B] = MAXX(filter(RLS User Table,[Email] = USERPRINCIPALNAME()),[A])

     

    here's also other blogs could be your reference:

    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

    https://radacad.com/dynamic-row-level-security-with-power-bi-made-simple

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-diye-msft,

       

      Thank you for the link. Greatly apreciated. I have it somewhat working at the moment but i have an issue. 

      I have 3 diffrent filtering criteria Country/BU/ INL. At the moment each user needs to information for each one of the criterias for RLS to work. If its missing one of the criterias it will show no data for the person. 

       

      Example:

      User: [email protected]

      User table: Sweden/BU1/EPC

      This is working fine.

       

      User: [email protected]

      User table: Sweden/BU1/

      Instead of seeing as above, he/she will see nothing because its missing the INL information (EPC)

       

       

      I have one Role with some code in each of the filtering tables

       
       

       

      How can i modify this code to allow it to filter if one of the users is missing one of the 3 requierd criteria ?

      Maybe som how :

       

      If(Users[2-BU]=Blank(), Ignore,

      CONTAINS (
      Users,
      Users[Email],
      USERPRINCIPALNAME(),
      Users[2-BU],
      [BU]
      )
      ||
      CONTAINS (
      Users,
      Users[Email],
      USERPRINCIPALNAME(),
      Users[4-Global],
      "Admin")

       

      What do you think? 

       

       

       

      The model

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Just bumping up to see if anyone has any comments on my previous post. 

         

        Kind regards