Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Dynamic RLS with many to many relationship

Hi, I would like to set up a Dynamic RLS with many to many relationship. Any advise would be greatly appreciated!   User access list  User Email Market Species [email protected] All Swine ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Anonymous 

    This is my idea. You may give it a try!

     

    1. Transform the UserAccessList table into the following structure: Replace "All" with all possible markets and species, then combine market and species to create a new key column in both UserAccessList table and Sales table. (To learn about how to transform the data with Power Query, you can download my sample .pbix file attached at bottom of this reply.) 

     

    2. Create a many-to-many relationship between Sales table and UserAccessList table, set up the cross-filter direction to Single (UserAccessList filters Sales).

     

    3. Create RLS role and set DAX rule on UserEmail column. Use UserPrincipalName() function for dynamic RLS. 

    4. Publish the report to Power BI Service, go to Security page of the semantic model to add users to the corresponding role. 

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!