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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.