Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set chart backcolor based on MonthName function

Hi I have a chart with a dimension of Monthname(Date), I want to set the backcolor of an expression depending upon what month it is, however i cant work it out. I have used the following expression

if(MonthName(myDate) ='Oct 2007' Or MonthName(myDate) = 'Nov 2007' , LightRed),

Can anyone please advise, I take it its because 'Oct 2007' is being read as a string as opposed to the date but i'm not sure how to go about converting it into the correct date type.

thanks

3 Replies
prieper
Master II
Master II

Hi,

the colour-names are functions and need to end with () , thus your example should work with:

if(MonthName(myDate) ='Oct 2007' Or MonthName(myDate) = 'Nov 2007' , LightRed()),

HTH

Peter


Not applicable
Author

Hi Peter,

Sorry the missing brackets were a typo, it still doesn't work with the brackets, any ideas why?

Thanks

Not applicable
Author

Hi onlyone,

see the attached example. Is this kind of coloring what you want to have?

Rainer