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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
UsePowerBI
Post Prodigy
Post Prodigy

How to create a custom slicer?

Hello

 

I have repeatedly asked for some clarity on how to create a custom slicer but I get answers that are not self-explanatory. 

Please if you don't want to describe ALL the steps to achieve this (ie. what and how to create tables, measures, slicers etc if needed) don't waste time to reply as I will not be able to use your answer.

 

I have a table that I want to filter based on whether a Col1 contains the string "A" or "B".

I want to create a slicer that will have two selections: A and B.

 

What do I need to code (table? measure?) and what do I need to drop in the slicer field?

 

Thanks!

1 ACCEPTED SOLUTION

Hi @UsePowerBI 

 

You can filter the value in the filter panel with measure =1, like below:

5.gif

Community Support Team _ Dina Ye
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

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @UsePowerBI 

 

Not sure if you'd like to get below results:

00.gif

Pbix attached

 

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

@v-diye-msft 

 

Not exactly, I need it to filter Col1 and display the values containing A or B.

 

Is that possible?

Hi @UsePowerBI 

 

You can filter the value in the filter panel with measure =1, like below:

5.gif

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@UsePowerBI , Assumption is that col1 is in independent table

measure =
var _max = maxx(allselected(Table),Table[Col1 ])
return
calculate(countrows(Table1), filter(Table1,containsstring(Table1[Column1],_max)))
nvprasad
Solution Sage
Solution Sage

Hi,

 

1. You can use the same column in the slicer and select the required string.

2. Click on "New Table" and use the below code to create a new table contains "A" or"B" then establish a relationship with your data and use this new column as a slicer.

SlicerTable = UNION(row("Slicercolumn","a"),row("Slicercolumn","b")).
3. Import "Slicervalues" from excel then establish a relationship and use imported column in the slicer.
 

Appreciate a Kudos! 🙂
If this helps and resolves the issue, please mark it as a Solution! 🙂

Regards,
N V Durga Prasad

 
 
 
 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors