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

Bar Chart in different color for current/future month

Hey Guys,

 

I have a Bar Chart with months on the x-axis and i would like to change the colour for those month in which we are current in and for those ones in the future.

So Sep, Okt, Nov, and Dez should be shown in a different colour.

Anyone who knows how to solve this???

Unbenannt.PNG

 

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods. Calculate the numbers for the year and month with calculated columns.

Month = Month([Date])
Year = YEAR([Date])

vzhangti_0-1664180072147.png

Measure:

Color = IF(SELECTEDVALUE('Table'[Month])>=MONTH(TODAY())&&SELECTEDVALUE('Table'[Year])>=YEAR(TODAY()),"Red")

vzhangti_1-1664180124549.pngvzhangti_2-1664180135189.png

Result:

vzhangti_3-1664180168081.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

6 REPLIES 6
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods. Calculate the numbers for the year and month with calculated columns.

Month = Month([Date])
Year = YEAR([Date])

vzhangti_0-1664180072147.png

Measure:

Color = IF(SELECTEDVALUE('Table'[Month])>=MONTH(TODAY())&&SELECTEDVALUE('Table'[Year])>=YEAR(TODAY()),"Red")

vzhangti_1-1664180124549.pngvzhangti_2-1664180135189.png

Result:

vzhangti_3-1664180168081.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

Anonymous
Not applicable

Hey @v-zhangti !

Do you maybe have a similiar Solution for a BarChart with quarterly view???

I tried: 

Future Dates_BarChart_Quarterly = IF(SELECTEDVALUE('Date Table'[Quarter])>=QUARTER(TODAY())&&SELECTEDVALUE('Date Table'[Year])>=YEAR(TODAY()),"#DD5252")
 
But im not able to choose this measure as a conditional field...it´s grayed out
Anonymous
Not applicable

Hi @v-zhangti,

thank you so much! That is working perfectly!

Do you know if i can change the "Red" into a colour-code?

Anonymous
Not applicable

I just tried and yes it is able to just switch "Red" into any colour code that is needed. In my example "#DD5252"

PaulDBrown
Community Champion
Community Champion

Create a measure to use for the conditional formatting along the lines of:

future dates = IF(MONTH(MAX(Table[Date])) > MONTH(TODAY()) && YEAR(MAX(Table[Date])) >= YEAR(TODAY()), "Red")





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Thanks Paul!
I guess this will go into the right direction, unfortunately there is something wrong with the function and i can´t figure out what it ist...

Should the Table[Date] part refer to my usual calendar table?

 

Unbenannt.PNG

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.