Page (Tab) Level Security & Conditional Navigation in Power BI!
Page level security was one of most requested feature in ideas.powerbi.com for many long time. With the May 2020 release of Power BI Desktop, I am?super?excited see that huge enhancements to drill through and page navigation options are available and they brings us new options and possibilities in terms of page navigation.
In this article I will focus on these new possibilities coming with custom page navigation but you can check out full blog post to learn more about all the new features of this month!
Since hiding and unhiding tabs affects all viewers, an workaround option was using buttons instead of native navigation, but it brings another requirement: switching target of a button dynamically.
With the new update, you can set target page of a button dynamically using DAX expression so same button can behave differently for different users!
Let's create a sample solution enabling page level security
The first step is creating a table with list of pages as shown below. Order column is needed to set display order and other columns are added for security filtering.
The second step is writing a DAX formula to define target page for different buttons. Below sample is for "Button 1", you can generate duplicate measures for each button.
Button 1 Destination =
MAXX (
? ? FILTER (
? ? ? ? ADDCOLUMNS (
? ? ? ? ? ? 'Page Level Security',
? ? ? ? ? ? "Rank", RANKX ('Page Level Security',[Order],,ASC)
? ? ? ? ),
? ? ? ? [Rank] = 1 //change this number with button number
),
? ? [Page Name]
)
Then you can set this measures as Page Navigation destination and also Text Label for Button 1, Button 2, and so on...
领英推荐
Then you can create a RLS role to test dynamic button destination:
Lastly, do not forget to hide all pages in native navigation bar.
All is done!
Now, when a user with "Seller" role is opened your report, 4th page (Profit) is not visible for this user as shown below:
Manager view:
Seller View:
Note: Lock icon in first image is just optional prefix on text label using Unicode emojis.
That’s all for my solution for custom navigation based on user role. You can extend same approach to enable "conditional drill-through" as well. If you have any feedback or improvement ideas on top of this, feel free to share your comments below. Hope to see you in another post!?
Edit: You can download sample pbix including hiding buttons and highlighting current page from: https://github.com/mustafaasiroglu/sampledata/blob/master/Conditional%20Navigation%20with%20RLS.pbix
Contract and Data Manager
2 年I am sure this is a silly question but how do I set the users for each of the roles that were just created? Everything has worked for me but I need to specify users for each of these roles and cannot find where to do that.
Principal at Prognos AG
2 年Hi Mustafa, I came across to you very usefull solution - works perfectly. As I would like to "structure" my buttons a bit more into 3 groups (A, B, C) I would like to ask you, if there is any possibility to "pre filter" group "A" and then use your proposed way to select the range within the pre-filtered group only (I really would like to avoid to create 3 different tables for this). Or do you have any other idea how I could procede... Thanks a lot for all your efforts.
--
2 年Hi Mustafa thanks a lot for this smart solution! I followed your steps and set people all to viewer access to workspace and to different roles. My result is partially working. When I test roles everything works fine. Different roles can see different pages. But when I test individual users, some of them worked and some not. Instead of seeing only their own group's pages, they still can see all. Do you have any ideas. Thanks!
Data Management | Business Analysis | Data Governance | Data Analytics | Business Intelligence
2 年Hi - thanks for sharing this, I wondered if anyone has come across an issue when using this where if their permissions aren't available for that role it shows the next page instead? My actions appear broken when testing the roles. Any suggestions greatly received! Do I just need to add to the DAX to ensure it doesn't move the action on to the next available page?