This tutorial shows, how to create a button, that only works for some roles.

If you use this button for navigation to a hidden page, it only provide access to this page to relevant users / roles.

How to do it?

New table

At first create a table with roles. (This is only one of few options, another one would use USERPRINCIPALNAME…)

Measure

Measure shows, which row is currently selected. It can be selected by slicer, or, in this case, by RLS.

Based on what was selected, the measure shows the name of page, or nothing.

  • Navigation = IF(
       SELECTEDVALUE(‘Table'[Roles])=”Manager”,
       “Secret page”,
       BLANK())

Button

Insert the button (Insert / Buttons / Blanks…). Its “Destination” is defined using previously created measure.

From now the button only works for people having the “Manager” role. Try it, using the “View as…” in Modeling.

Button color based on availability

Similarly, you can change the button color – so as user recognizes, whether the button is active (yellow, in this example) or inactive (grey, in this example).

Obdobně můžeme upravit i barvu tlačítka – aby uživatel poznal, že tlačítko je aktivní (např. žluté) nebo neaktivní (např. šedivé).

Vytvoříme další míru, např.:

  • Color = IF(
       SELECTEDVALUE(‘Table'[Roles])=”Manager”,
       “#FFFF00”,
       “#DCDCDC”)