Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

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

Re: change color conditional in chart

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>')
10 Replies
afuchten
Valued Contributor

change color conditional in chart

why not adding the 27 in the if-expression?

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

Sokkorn
Honored Contributor

change color conditional in chart

Hi,

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

Regards,

Sokkorn

Sokkorn
Honored Contributor

Re: change color conditional in chart

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

chauhans85
Esteemed Contributor

change color conditional in chart

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())

Not applicable

Re: change color conditional in chart

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.

MVP
MVP

change color conditional in chart

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

Re: change color conditional in chart

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

Re: change color conditional in chart

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

Re: change color conditional in chart

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)

Community Browser