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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jf2204
New Member

How to filter values in a slicer based on role in RLS

Hi, I have a slicer that lists all the divisions in the company. I need to be able to hide certain divisions based on the role the user is assigned in RLS. Is this possible. E.g. if someone is in a role "Non-HR" then I want the division Human Resources to be hidden from being selected in the slicer. However, the visuals on the page must still use the values from the Human Resources division. 

1 ACCEPTED SOLUTION

Hi , @jf2204 

According to your description, the end need is " just hiding values from the slicer".

If this , Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1675653142446.png

(2)If you do not see the "c and d" in slicer we can use this measure:

Measure = var _slicer = SELECTEDVALUE('Table'[Column1]) 
return
IF(_slicer in {"c","d"} ,-1 ,1)

 

(3)Then we can put the measure on the "Filter on this visual" and we can meet the need.

vyueyunzhmsft_1-1675653241737.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

4 REPLIES 4
jf2204
New Member

An alternative solution I could consider is to have two different slicers and they are either visible or hidden based on the role. Can we show / hide visuals based on RLS?

Hi , @jf2204 

As I understand it, you want to display different ranges of values on the slicer depending on the user.

For your needs, you only need to limit the values of the table of the slicer fields you place through RLS. Because the content in the slicer is also from the original data, as long as the original data is affected by RLS, only the data that the person can see will be displayed.

 

For more information, you can refer to :
Row-level security (RLS) with Power BI - Power BI | Microsoft Learn

Dynamic Row Level Security with Power BI Made Simple - RADACAD

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

If I use RLS on the table in the slicer then my visuals that aggregate the data will only aggregate on the values in the table that the user can see. The issue I have is for example, I want to show the entire company headcount in one visual and then in a second visual the user can select a division and see the headcount of that division. If I user RLS and filter the table the headcount for the entire company will not be accurate. Hence why I was thinking of just hiding values from the slicer as opposed to filtering the table that is used for the slicer.

Hi , @jf2204 

According to your description, the end need is " just hiding values from the slicer".

If this , Here are the steps you can refer to :
(1)This is my test data:

vyueyunzhmsft_0-1675653142446.png

(2)If you do not see the "c and d" in slicer we can use this measure:

Measure = var _slicer = SELECTEDVALUE('Table'[Column1]) 
return
IF(_slicer in {"c","d"} ,-1 ,1)

 

(3)Then we can put the measure on the "Filter on this visual" and we can meet the need.

vyueyunzhmsft_1-1675653241737.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors