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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
rohanazad94
Frequent Visitor

How to change the color of slicer values

I have a column in my table called "Scores". scores has 4 unique values which are "M", "B", "S", "T"

after selecting the "Scores" column as a slicer, I want to display the display slicer values in the fllowing color format and in the following order. 

rohanazad94_0-1666299828318.png

Can I get any suggestion as to how can that be done?

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @rohanazad94 ,

According to your description, here's my solution.

1.Then text type column sorts in alphabetical order by default. If you want it so sort in a custom order, add a custom column in Power Query.

vkalyjmsft_0-1666333729464.png

Rank = if [Scores] = "M" then 1 else if [Scores] = "B" then 2 else if [Scores] = "S" then 3 else 4

Then in Desktop, select Scores column, then click Sort by column>Rank.

vkalyjmsft_1-1666333787758.png

Result:

vkalyjmsft_2-1666333849372.png

2.Conditional formatting is not allowed in slicer by default, you can only use it in other visuals, like table visual.

Color =
SWITCH (
    MAX ( 'Table'[Scores] ),
    "M", "Green",
    "B", "Yellow",
    "S", "Purple",
    "T", "Red"
)

Select the visual, then in visual formatting pane, under Cell elements, turn on the Backgroud color.

vkalyjmsft_3-1666334040733.png

Select the measure in the dialoge.

vkalyjmsft_5-1666334156634.png

Result:

vkalyjmsft_6-1666334203701.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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-yanjiang-msft
Community Support
Community Support

Hi @rohanazad94 ,

According to your description, here's my solution.

1.Then text type column sorts in alphabetical order by default. If you want it so sort in a custom order, add a custom column in Power Query.

vkalyjmsft_0-1666333729464.png

Rank = if [Scores] = "M" then 1 else if [Scores] = "B" then 2 else if [Scores] = "S" then 3 else 4

Then in Desktop, select Scores column, then click Sort by column>Rank.

vkalyjmsft_1-1666333787758.png

Result:

vkalyjmsft_2-1666333849372.png

2.Conditional formatting is not allowed in slicer by default, you can only use it in other visuals, like table visual.

Color =
SWITCH (
    MAX ( 'Table'[Scores] ),
    "M", "Green",
    "B", "Yellow",
    "S", "Purple",
    "T", "Red"
)

Select the visual, then in visual formatting pane, under Cell elements, turn on the Backgroud color.

vkalyjmsft_3-1666334040733.png

Select the measure in the dialoge.

vkalyjmsft_5-1666334156634.png

Result:

vkalyjmsft_6-1666334203701.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

 

Thank you so much. The solution you provided worked.

TomMartens
Super User
Super User

Hey @rohanazad94 ,

 

I'm unaware of any custom visual that provides the capability you are looking for. The default Slicer visual does not support this capability.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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