Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Phil_PowerBI
Frequent Visitor

Slicer Values not getting passed to a Role

I have successfully created a role in Power BI to control access to the content of my report using the DAX script below:

 

SWITCH(

       TRUE(),

       [SecuredAccessType] = "Full Access", 1=1,

       [SecuredAccessType] = "Standard Access", 1=1,

       [SecuredAccessType] = "Limited Access" && [SecuredOfficeGroupAccessType] = "See Data of All Office Groups", 1=1,

       [SecuredAccessType] = "Limited Access" && [SecuredOfficeGroupAccessType] <> "See Data of All Office Groups", DimOriginatingOffice[Office Group] = [SecuredOfficeGroup],

       1=1

       )

 

I have now been told that under some conditions, it would be great if they can turn the role on and off. I have created slicer with two values to handle this – Secured and Unsecured.I also created a Measure to capture the selected value of the slicer as shown below:

 SecuredMode = SELECTEDVALUE('Report Mode'[ReportMode])

 

I then simply wrapped a simple IF statement around my DAX to handle this as shown below:

 

IF ([SecuredMode] = "Secured",

SWITCH(

       TRUE(),

       [SecuredAccessType] = "Full Access", 1=1,

       [SecuredAccessType] = "Standard Access", 1=1,

       [SecuredAccessType] = "Limited Access" && [SecuredOfficeGroupAccessType] = "See Data of All Office Groups", 1=1,

       [SecuredAccessType] = "Limited Access" && [SecuredOfficeGroupAccessType] <> "See Data of All Office Groups", DimOriginatingOffice[Office Group] = [SecuredOfficeGroup]

             ), 1=1)

 To my surprise, it appears that my slicer selection does not get recognised as no matter how many times I change the selection, my role expression always resolve to the default value of my IF statement.

 

 

Is this a limitation in POWER BI or am I doing something wrong?

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Phil_PowerBI,

 

No. It is not possible to dynamically turn on/off the RLS based on a slicer selection.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Phil_PowerBI,

 

No. It is not possible to dynamically turn on/off the RLS based on a slicer selection.

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for the confirmation. I just wanted to be sure there was niothing I was doing wrong.

Phil_PowerBI
Frequent Visitor

I have done further tests to prove that the slicer value is blank within the role. Outside the role on the report, the slicer value gets passed correctly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.