Forum Discussion

denemee123's avatar
denemee123
New Member
3 years ago
Solved

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. 

Thank you for your help. 

  • 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

  • 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

     

    Here is the rule

     

    Giving this

    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

5 Replies

  • 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

     

    Here is the rule

     

    Giving this

    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

  • 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

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