Power BI — How to Create a Hidden Section with Conditional Access

Igor Comune
Microsoft Power BI
Published in
4 min readJun 25, 2024

Learn how to create a hidden section with multiple pages using a single measure in 5 simple steps.

Ideogram.ai prompt: modern image for background, power bi row level secutiry

As most of you probably already know, there is no PAGE RLS implemented in Power BI as of jun/24. If are part of the Fabric/Power BI Community you can support this idea here.

Page RLS

Sometimes implement an RLS in an already-in-production dashboard can be impracticable, due to multiples reasons as: existing RLS, lack of data, data modeling, filter directions…

So I recently figured out a simple way to create a Page RLS (multiple pages, or, henceforth “Section”) with a single measure.

How to

Step 1 — Username

Create a measure called user:

user = USERPRINCIPALNAME()

Using this function you’ll get the e-mail of the user.

Step 2 — Create the Tabs

Image 1 — Tabs

In my case, I created 4 tabs: Page 1, Page 2, Hidden 1 and Hidden 2. The hidden tabs will be called “Hidden Section” (in red) and the green will be called “Open Section”.

Step 4 — Create the another measure

The following measure will lead you to the hidden section of the dashboard.

Page Name = 

var pagename = "Hidden 1" // Select the page name in the Hidden Section
var restricted = "no permission" // In case you are not allowed to enter the hidden section, another tab will be displayed.

return
if(
[user] == "teste@teste.com" // the e-mail of the person which will have access to the Hidden Section
// || [user] == "anyotheremail@teste.com"
// || [user] == "asmanyemailsasyouwant@teste.com"
,pagename
,restricted
)

Explaining the measure above

In the Page Name measure we define two variables:

  • pagename: which will lead us to the hidden section
  • restricted: if the user is not allowed into the hidden section, he’ll directed to a tab telling him about it.

In the return we have a conditional, IF the USERPRINCIPALNAME() or E-MAIL is equal to a certain e-mail (that you’ll define) they will go to pagename variable, if don’t, it will lead them to the restriction page.

Step 5 — Button

Create any button you want

Image 2 — Button Example
  1. Go to the format panel > action
  2. Select type as “Page navigation”
  3. Click in fx
Image 3 — Format Button
  1. Format style, choose: Field Value
  2. in “What field should we base this on”, select the measure: Page Name
  3. Click ok, and it’s done!
Image 4 — Destination of the Action

Now let’s try it!

Go to the modeling > view as.

In Other user, write the e-mail as the following example:

Image 5 — Testing the access

Now click on “RESTRICTED AREA” and it will take you to “Hidden 1”.

Image 6 — Logged

Tips

Inside the “Hidden section” you’ll need to create buttons to navigate inside the hidden tabs and in the “Open Section” there will be only a single button to take you to the Hidden Section.

When you publish it into the Power BI Service the user will only be able to see the “Open Section” and the only way to get to the “Hidden Section” and navigate through it, will be using the buttons you created.

If you want to see the file (.pbix), here it is:

https://drive.google.com/file/d/1qwOACQWUmKVva2ae49Um64Qxah8SGxc0/view?usp=sharing

Igor Comune.

Don’t forget to subscribe to

👉 Power BI Publication

👉 Power BI Newsletter

and join our Power BI community

👉 Power BI Masterclass

--

--

Microsoft Power BI
Microsoft Power BI

Published in Microsoft Power BI

Microsoft Power BI community sharing our Power BI experience, tutorials, use cases, tips and tricks. Learn together. Grow together. Follow our Power BI Masterclass: https://linktr.ee/powerbi.masterclass or me: https://linktr.ee/tomas.kutac

Igor Comune
Igor Comune

Written by Igor Comune

An "under construction" Data Scientist with a love for numbers and analysis!

Responses (1)