Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Simple KPI How to make % variance when +ve color change to Blue -ve RED ?

Hi All

I copy the this KPI from QS example , i dont know how to make the % change to red color when % is +ve ? Now it display black color , i need to make it display Red color when -ve. Now alway black.

I have try use the below expression , i insert at color value :-

=if([Sales vs Target] <0% ,'#d01919','#545352')

But it does not work.

Paul

1 Solution

Accepted Solutions
danansell42
Creator III
Creator III

As mentioned above, you haven't included the *-1 in the colour expression to finish of the simulation.

The colour expression evaluates separately from your main expression and is therefore still calculating a positive number.

I've just tested it and works perfectly for me.

Capture.PNG

Example for colour expression:

if(-1*if(

(

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1000/Rate)

/

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1000/Rate)

)

>1,1,

(

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales/1000/Rate)

/

Sum({$<year = {$(=Max(year)-0)}, month = {"<=$(=Max({<year={$(=Max(year))}, sales = {'*'}>} month))"}>}sales_target/1000/Rate)

)

) >0 ,'#d01919','#545352')

View solution in original post

24 Replies
paulyeo11
Master
Master
Author

My qvf

Not applicable

Hi Paul,

The app is showing invalid visualisation (the visualisation was not found on the server: qsSimpleKPI).

Anonymous
Not applicable

Hi Paul,

you can change ur expression to the below expression:

=if([Sales vs Target] <0 ,RGB(255,0,0),RGB(0,255,0))


Note:

Change the RGB values according to the colour u want

paulyeo11
Master
Master
Author

‌Hi Karupreet

thank you for your reply , I will try this evening.

DOes it mean that QLIK VIEW script for Color expression is not same as KPI Sample ? Need to follow KPI Sample style of writing ?

PAul

paulyeo11
Master
Master
Author

‌HI Nhu

KPI Simpel is qlik sense extension.

in order to remove the error , you need to install KPI SIMPLE EXTENSION to your QS DESKTOP .

NEed to to downlod from qlik branch .

thank you for your help

paul

Anonymous
Not applicable

Hi Paul,

What exactly is ur requirement ? you want to make the text colour change or the bar/ line colours?

If you want to the chnege the text colours then u need to write the same expression in

Right Cick -> Properties -> Font -> Colour -> Calculated Expression

and if you want to change the bar colour then

Right Cick -> Properties -> Expression -> Add your expression -> You will find a plus sign on the expression name, click on that -> colour -> paste the above expression


Regards

Karunpreet

paulyeo11
Master
Master
Author

Hi Karunpreet

Base on your reply , I think you refer qlik view right ?

Paul

Sent from my iPhone

Anonymous
Not applicable

Yeah. But u can write the same expression in QlikSenseas well

paulyeo11
Master
Master
Author

I am refer to KPI EXTENSION for qlik view

Sent from my iPhone