Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
argsaha
Contributor
Contributor

Color by expression is not working in Qlik Sense Line Trend

Dear All,

I am facing a problem during projection of different colors in Line Chart using Color by expression feature.

I have a YEARMONTH field from my loading script which is having values in YYYYMM format e.g. 202101,202102 etc.

Within the line trend I have used expression num#(Date(Date#(YEARMONTH,'YYYYMM'),'YYYY')) to convert it into X-Axis (year) as line trend and it is working fine, but when I am using this same expression within IF statement to project multiple colors e.g. red for 2019,green for 2020 it is not working.

The color by expression is mentioned below :

IF(num#(Date(Date#(YEARMONTH,'YYYYMM'),'YYYY')) = 2019,red(),
IF(num#(Date(Date#(YEARMONTH,'YYYYMM'),'YYYY')) = 2020,green(),
IF(num#(Date(Date#(YEARMONTH,'YYYYMM'),'YYYY')) = 2021,blue(),
IF(num#(Date(Date#(YEARMONTH,'YYYYMM'),'YYYY')) = 2022,yellow()
))))

I am using Color by expression with 'The expression is a color code' is checked.

Kindly suggest if there is a change needed in the expression above to project different colors for yearwise trend lines.

Thanks in advance

Arghya

 

 

Labels (1)
1 Reply
Andrew_Delaney
Support
Support

Would it be possible to have a sample app with what you have so far for this visualisation?