Business Analysis Community Question

How do I handle Dynamic Row-Level Security for users across multiple departments?

Posted on 2025-06-05 • In Business Analysis • By Angela Davis

I need to set up a single Power BI report where managers can only see data for their specific department. I’ve tried basic RLS, but my user list is constantly changing. Does anyone have a template for "Dynamic RLS" using the USERPRINCIPALNAME() function? I have a mapping table that links User Emails to Department IDs, but I’m not sure how to set up the relationship so it filters the main Fact table correctly without causing circular dependency errors.

3 Answers 8,976 Views

All answers to this question 3 Answers

Patricia Higgins Answered on 2025-07-12
Answered

The best practice for Dynamic RLS is to have a "Security Mapping" table that contains the email addresses and the Department IDs. You should create a 1-to-many relationship from the Security table to your Department Dimension table, and ensure the "Apply security filter in both directions" checkbox is selected. Then, in the RLS Role settings within Power BI Desktop, add a filter to the Security table: [Email] = USERPRINCIPALNAME(). This ensures that when a user logs in, the security table filters down to just their row, which then filters the dimension table, and finally the Fact table. It’s clean, scalable, and doesn't require hardcoding names.

Thomas Wright Answered on 2025-07-25
Answered

Are you dealing with a "Many-to-Many" scenario where one manager might oversee three different departments at the same time?

Angela Davis Commented on 2025-08-02
Commented

Thomas, yes! Some of our directors have oversight of multiple business units. I was worried about how the relationship would handle that. Based on Patricia's advice, I think I just need multiple rows in my mapping table for those specific users. As long as the relationship is set up correctly, the filter should propagate for all the Department IDs associated with that director's email address. I’ll just need to be careful about the performance impact of "bi-directional" filtering on such a large model.

Kevin Spacey Answered on 2025-08-15
Answered

Always test your RLS roles in the Power BI Service using the "Test as Role" feature. What works in Desktop often behaves differently once published.

Patricia Higgins Commented on 2025-08-20
Commented

Kevin is right. Testing in the Service is the only way to be 100% sure that your AD groups are correctly mapped to the RLS roles you've created.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.