Forum Discussion
Power BI Row Level Security on a single page?
- 1 year ago
Hi BassG ,
Power BI doesn't natively support applying Row-Level Security (RLS) to just a single page, as RLS is model-wide by default. However, a practical workaround is to create a duplicate of the pupil-level data table specifically for the page that needs restriction. You can then apply RLS only to that duplicated table by linking it to your Permissions or School table, and use this version exclusively on the pupil-level page.The rest of the report can continue using the original, unrestricted school-level data without being affected by RLS. This allows you to restrict detailed pupil-level data while keeping the other pages open and filterable across all schools.
Alternatively, for a less secure but simpler method, you can create a DAX-based visual-level filter that checks if the user has access to the school and only displays pupil-level visuals when appropriate. From your data model image, it seems you're already working with multiple school-related tables, so it's important to ensure only one of those drives the RLS logic to avoid complications from ambiguous relationships.
You're correct that Power BI's Row-Level Security (RLS) typically applies to the entire dataset, but there are a few possible workarounds to implement "single-page" RLS for your scenario.
If your dataset includes a mapping of users to schools (looks like it does), you can dynamically filter the pupil page while keeping other pages unrestricted.
Create a User Table with School Assignments:
UserEmail | SchoolID
--------------------------
[email protected] | A
[email protected] | B
Use the Following RLS Filter:
[SchoolID] = LOOKUPVALUE(UserTable[SchoolID], UserTable[UserEmail], USERPRINCIPALNAME())
Apply this RLS only to the pupil dataset, leaving school-level data unrestricted.
Modify Visuals to Prevent Cross-School Pupil Viewing:
- Apply a filter to the pupil-level table that restricts viewing unless the user belongs to that school.
Please mark this post as solution if it helps you. Appreciate Kudos.
- BassG1 year ago
Helper I
Thanks for this.
Unfortunately, the pupil and the school level data all come from the one dataset.
The main columns are School Name, Pupil Name, Pupil ID, Possible Attendance, Present Attendance, & Attendance %.
Each row is for a pupil & for the school overall, it's a calculation of Present Attendance/Possible Attendance.
Good to know how to do it on 2 separate datasets, so I could make a copy of the dataset & use your solution on it.
Cheers, Graeme