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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
denemee123
New Member

Customize Column Colors in Stacked Column based on Date

Hi,

 

I want to customize column colors based on date field. I use stacked column chart in my project, in shared axis there are 2 different field (date and job names). For column values, I try to change colors of columns according to date, i.e. for future I want to see column color as red, for past I want to get column color as green. Below figure is just an example. 

denemee123_1-1667202694693.png

Thank you for your help. 

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

Hi @denemee123 

 

The stacked column chart doesn't let you set the column colors in this way.  You can only choose set colors for each category.

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

PhilipTreacy
Super User
Super User

Hi @denemee123 

 

Download example PBIX file with charts etc shown below

 

If you want to set the column colors based on whether they are in the past or future, then you don't want to see each category in a different color?

 

In which case you can use a Clustered Column or a Stacked Column, plot the data for all categories in one column, per year, and use a Conditional Formatting rule to set the column colors accordingly.

 

Write a measure like this

 

Column Color = IF(MAX('DataTable'[Date]) < TODAY(), "#0F0", "#F00")

 

 

Format the visual : select fx to create a Conditional Formatting rule

formviz.png

 

Here is the rule

formviz2.png

 

Giving this

formviz3.png

Note 1 I when I took this screenshot I had red dates in the past, green for the future.  You want it the other way around.  The measure (above) to set the color does it as you want.  It's easy to change.  Red is "#F00", green is "#0F0"

Note 2 this is a Line & Stacked Column chart and it's only plotting the Sum of value on the y-axis.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

5 REPLIES 5
MadsD
Frequent Visitor

Hi! Try to go to Visual - Columns - Colors and then each category should have a color to assign to.

MadsD_0-1712571533727.png

 

PhilipTreacy
Super User
Super User

Hi @denemee123 

 

Download example PBIX file with charts etc shown below

 

If you want to set the column colors based on whether they are in the past or future, then you don't want to see each category in a different color?

 

In which case you can use a Clustered Column or a Stacked Column, plot the data for all categories in one column, per year, and use a Conditional Formatting rule to set the column colors accordingly.

 

Write a measure like this

 

Column Color = IF(MAX('DataTable'[Date]) < TODAY(), "#0F0", "#F00")

 

 

Format the visual : select fx to create a Conditional Formatting rule

formviz.png

 

Here is the rule

formviz2.png

 

Giving this

formviz3.png

Note 1 I when I took this screenshot I had red dates in the past, green for the future.  You want it the other way around.  The measure (above) to set the color does it as you want.  It's easy to change.  Red is "#F00", green is "#0F0"

Note 2 this is a Line & Stacked Column chart and it's only plotting the Sum of value on the y-axis.

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you for yor effort 🙂 I got it.

PhilipTreacy
Super User
Super User

Hi @denemee123 

 

The stacked column chart doesn't let you set the column colors in this way.  You can only choose set colors for each category.

 

regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy ,

 

Thank you for your reply. Well, is there any visual to apply what I want in PowerBI?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.