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

change color conditional in chart

I want change color if selected Accounting Period (AP)  is greater than current AP in Chart, but my implementation does not work, in the graphik example it should change from yellow to red if AP_KEY is greater or equal 27, see example app.
Background color property of expression:
=
IF(DSS_DATE.AP_KEY>=$(=DSS_DATE.AP_KEY) ,Red(),Yellow())
1 Solution

Accepted Solutions
Not applicable
Author

The Solution, with the help of Community Collegus from another similar topic.see attached ap
The Formula which solved the problem was:
=IF(ONLY({<DSS_DATE.AP=,DSS_DATE.F_YEAR=>} DSS_DATE.AP_KEY) <= MAX(TOTAL DSS_DATE.AP_KEY), '<S1>','<S3>')

View solution in original post

10 Replies
Anonymous
Not applicable
Author

why not adding the 27 in the if-expression?

if(DSS_DATE.AP_KEY >= 27, Red(), Yellow())

Sokkorn
Master
Master

Hi,

Why don't you add new expression: =$(=DSS_DATE.AP_KEY)

Regards,

Sokkorn

Sokkorn
Master
Master

Hi,

You can give a label to your expression (I use Test) then try in background: =IF([Test]>=$(=DSS_DATE.AP_KEY),Red(),Yellow())

Edit: See the sample attached file.

Regards,

Sokkorn

SunilChauhan
Champion II
Champion II

Create a variable

DSS_DATE.AP_KEY=DSS_DATE.AP_KEY or  DSS_DATE.AP_KEY=only(DSS_DATE.AP_KEY)

then use following

IF(DSS_DATE.AP_KEY>=$(DSS_DATE.AP_KEY) ,Red(),Yellow())

Sunil Chauhan
Not applicable
Author

Hi Sunil

Good approach, but same effect, it does not work. I added a new example, any the funny thing ist ,the color does change but only if the Chart AP_Key ist equal $(vAP_KEY) but it should change color for all rows if AP_KEY is  GREATER OR EQUAL THAN $(vAP_KEY)
see new example, I have no clue what I am doing wrong.

jagan
Luminary Alumni
Luminary Alumni

Hi uweh,

Remove the background color expression for expression, and go to the visual clues tab in Properties,

Give $(vAP_KEY) in "Upper >= " text box and select Red as background color.

Similarly Give ($(vAP_KEY) -1) in "Lower <=" text box and select Yellow color as background.

Hope this helps you.

Regards,

Jagan.

Not applicable
Author

Hi Jagan, also a good approach, but unfortunately I need it in my real application for a Graph-Chart and I want set the line dotted or not, the expression in the line-style property will then be:

=

IF(DSS_DATE.AP_KEY<=$(=DSS_DATE.AP_KEY) ,'<S1>', '<S3>')

instead of Background color.

Not applicable
Author

Hi Sokkorn,
I forgot to mention that it depends on the Time and not on the content of the value, say if the date (AP) is higher then the choosen Date, then I need to mark (in the example background color, in the  real App a dotted line instead a normal line) , that means it is a forecast-value and not a demand-value.

Not applicable
Author

I have the feeling I am really close, in the example you cann see if I chosse more than one AP, let say AP 4-8
the the lin is dotted or the background is red.
What I need is the User only selects one AP, lets say AP = 4 and the dotted line or the background color is dotted resp. red for AP4 until endless (AP4 to AP12 in my case)