Forum Discussion
Changing bar colour based on a Bar graph
Hi!
Is it possinle to chnage the colour of the bars in a bar chart based on a condition where keep all the bars for example blue if its before current month and red if its after current months. Say I have a chart with dates in x axis and sales amount on the y axis an I want to show all the sales until June in Blue bars and and July on wards in Red , is it possible yo do so?
Thanks,
Hi Anonymous ,
As I know, if you want to use conditional formatting on bar color, you can't add field in Legend. You could refer to my sample for details.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
9 Replies
- AnonymousNot applicable
Hi,
Step 1 : Create a measure with DAX as below:
Current Month = MONTH(TODAY())
Step 2 : Create a column for finding month from the date your have:
Month of shipdate = MONTH(Orders[Ship Date].[Date])Step3 : Create another measure with DAX as below:Previous Or Future = IF(Orders[Month of shipdate]<[Current Month],"Previous","Future")Drop this "Previous Or Future" to Legends of your Bar chart.- AnonymousNot applicable
Step 3 it does not allow me to make the meassure with that option.
- AnonymousNot applicable
Sorry, Its suppose to be a New Column and not New Measure as this is categorical in nature.
Hope this solves your issue.
- dax
Community Support
Hi Anonymous ,
As I know, if you want to use conditional formatting on bar color, you can't add field in Legend. You could refer to my sample for details.
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Great , can we do this same for clustured bar chart with multiple bars on it, because that is the problem I am facing now, I dont see the option for formating color when I have 2 bars(2 columns on Column value section)?
- dax
Community Support
Hi Anonymous ,
I don't see Column value in clustured bar chart, if possible, could you please inform me more detailed information(such as your simple sample data and your chart setting)?
Best Regards,
Zoe ZhiIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.