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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

clustered bar chart color coding

Hello All,

 

I have a clustered bar chart and having different values

Sales1, Sales 2, Sales 3 .

 

Now I need to change the color for each bar based on thier value, But I see there is no custom color option for this chart.

Could any one suggest how to do this

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

Hi @Anonymous ,

 

Please use the IF() or SWITCH() functions to create similar measure and use it as a conditional format for visuals.

 

Measure = 
VAR _total = SUM('Table'[Value])
VAR _colour =
SWITCH(
    TRUE(),
    _total>=5000 && _total<=6000,"Blue",
    _total<5000, "Red",
    _total>6000, "Green"
)
return
_colour

 

vcgaomsft_0-1655891078914.png

vcgaomsft_0-1655891364276.png

Attached PBIX file for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please use the IF() or SWITCH() functions to create similar measure and use it as a conditional format for visuals.

 

Measure = 
VAR _total = SUM('Table'[Value])
VAR _colour =
SWITCH(
    TRUE(),
    _total>=5000 && _total<=6000,"Blue",
    _total<5000, "Red",
    _total>6000, "Green"
)
return
_colour

 

vcgaomsft_0-1655891078914.png

vcgaomsft_0-1655891364276.png

Attached PBIX file for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

FarhanAhmed
Community Champion
Community Champion

you can change the color  by going to the Format your Visual then go columns and create a expression for your data bar color

 

FarhanAhmed_0-1654517817645.png

 







Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Kudoed Authors