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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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,

 

1 ACCEPTED SOLUTION
dax
Community Support
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.

754.PNG

Best Regards,
Zoe Zhi

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

9 REPLIES 9
dax
Community Support
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.

754.PNG

Best Regards,
Zoe Zhi

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

Anonymous
Not 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
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 Zhi

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

Anonymous
Not 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.
 

 

Anonymous
Not applicable

Step 3 it does not allow me to make the meassure with that option.

Anonymous
Not applicable

Sorry not step 3 , thats fine, but the issue is cannot add it to the legend.

Anonymous
Not applicable

Sorry, Its suppose to be a New Column and not New Measure as this is categorical in nature.

 

Hope this solves your issue.

Anonymous
Not applicable

I created both meassure and cloum but the issue is I am unable to add it to the legend on my clustered bar chart.

Anonymous
Not applicable

Please provide a sample workbook to work on as i'm able to do with my data set.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.