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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to create custom slicers?

Hello

 

I have the data below:

 

Col1Col2Col3
A1100
A2101
B3102
B4103
B5104

 

I would like to a create custom slicer that will have a tickbox named 'Top 3' and when you click that, it will filter to the largest three records based on Col2 and a tickbox named 'Bottom 3' to select the smallest (complying with any additional filters of course).

 

How can I do that?

 

Thanks!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create a table.

 

tickbox = {"Top3","Buttom3"}

 

(2) We can create a measure. 

 

Flag =
var _selectedvalue=SELECTEDVALUE(tickbox[Value])
var _topn=SELECTCOLUMNS(TOPN(3,ALLSELECTED('Table'),'Table'[Col2],ASC),"1",'Table'[Col3])
var _buttom=SELECTCOLUMNS(TOPN(3,ALLSELECTED('Table'),'Table'[Col2],DESC),"1",'Table'[Col3])
return
SWITCH(    _selectedvalue,    
"Top3",IF(MAX('Table'[Col3]) in _topn,1,0),    
"Button3",IF(MAX('Table'[Col3]) in _buttom,1,0),    
1)

 

(3) As shown in the following image, set up filtering on visuals and then the result is as follows.

Picture1.png

Best Regards,

Neeko Tang

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

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

According to your description, here are my steps you can follow as a solution.

(1) We can create a table.

 

tickbox = {"Top3","Buttom3"}

 

(2) We can create a measure. 

 

Flag =
var _selectedvalue=SELECTEDVALUE(tickbox[Value])
var _topn=SELECTCOLUMNS(TOPN(3,ALLSELECTED('Table'),'Table'[Col2],ASC),"1",'Table'[Col3])
var _buttom=SELECTCOLUMNS(TOPN(3,ALLSELECTED('Table'),'Table'[Col2],DESC),"1",'Table'[Col3])
return
SWITCH(    _selectedvalue,    
"Top3",IF(MAX('Table'[Col3]) in _topn,1,0),    
"Button3",IF(MAX('Table'[Col3]) in _buttom,1,0),    
1)

 

(3) As shown in the following image, set up filtering on visuals and then the result is as follows.

Picture1.png

Best Regards,

Neeko Tang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.