29 Nov 2023 Applying Page Level Security in Power BI
While Power BI inherently supports Row Level Security (RLS), there is no official solution for selectively displaying or hiding pages for specific users. In this article, we’ll elaborate on a technique to do so based on user permissions.
Consider this scenario: we own a shoe manufacturing business with multiple retail outlets, and we plan to provide each store with reports about their sales in comparison to their targets. However, we also want to include a page in the same report offering a deeper analysis for the exclusive use of the store managers, hidden from other staff.
Essentially, the store staff will only have access to their sales reports, whereas the managers can view all the pages.
Applying Page Level Security in Power BI
We can apply Page Level Security by following these steps:
1. Define a Roles Table: We need a table containing the different roles, and for this example we have created these roles:
- Admin: Access to all pages.
- Store: Access to all pages except one.
Figure 1: Roles table
2. Go to Modeling – Manage roles and create these roles:
- Role Admin: [Role] = “Admin”
- Role Stores: [Stores] = “Stores”
Figure 2: Role configuration
3. Create the next DAX measure:
Figure 3: Action DAX Measure
This measure will configure a button that will be visible if the user has the Admin role, whilst remaining hidden if the user has the Store role.
In addition, a Navigation Page needs to be configured for the Admin role.
4. Buttons configuration: Go to Insert – Buttons and select a Blank button.
These buttons will be equipped with a page navigation action. The configuration varies based on whether the navigation is intended for both roles, or solely for the Admin role.
- Page Navigation for both roles
- Page Navigation just for the Admin role
Create a blank button as above. In Format, enter the text and add a page navigation action:
Figure 4: Text configuration
Figure 5: Page navigation configuration
In our example, we have now created 3 buttons.
This button must be visible for the Admin role, but must be hidden from the Store role. We can implement this by applying text conditional formatting based on the Action measure instead of manually entering the text.
To do so, we will add a text conditional formatting based on the Action measure instead of writing the name:
Figure 6: Text conditional formatting
The navigation action will be also conditional, based on the Action measure:
Figure 7: Action Conditional formatting
5. Hide the pages you would like to restrict; in our example that’s the page titled “4. Store analysis”.
6. Publish the report on Power BI Service.
7. In Power BI Service, go to the Dataset and select Security, where you can manage the roles and user assignments.
Figure 8: Security
8. Check that Page Level Security is working by selecting the option Test as a role.
Figure 9: Test as a role
When we test the Admin role we can see all the buttons and navigate through the whole report:
Figure 10: Test Admin role
Conversely, the Store role conceals the “4. Store Analysis” button and restricts access to this section:
Figure 11: Test Store role
Conclusion
The ability to hide specific pages from certain users in Power BI can be highly beneficial, yet an official feature for this purpose is currently absent. Fortunately, the method we’ve outlined in this article serves as a viable workaround.
For assistance with Page Level Security or any other Power BI functionality, feel free to reach out to us here at ClearPeaks. Our team of seasoned and certified experts is ready to help you along your BI journey!