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

24 Replies
danansell42
Creator III
Creator III

Hi Paul

This seems to be a link to your email which obviously i cant access.

Thanks

Dan

paulyeo11
Master
Master
Author

Hi Daniel

His reply only text below :-

You can use variables for storing expressions. For example, you can define variable in the script like this:

SET vKPI = 'SUM(sales)'; // simple expression just for example

Use macros in the expressions like this:

if( $(vKPI) > 0, ,'#d01919','#545352')

But when i try i cannot make it , may be you can help to test out see you have luck ?

Paul

paulyeo11
Master
Master
Author

‌HI All

wow I am  surprise that this post have 233 view , one vietnam lady reply , and one from India reply but both only QV user not QS yet they still to help me thAnk you very much.

i Believe Daniel is QS user , and he try all his way to help me I appreciate it very much.

EVen now I still not yet find the solution , I believe one days I sure can get it , because nothing is impossible .

PAul

danansell42
Creator III
Creator III

Hi Paul,

I think what the developer is saying is to store your expression as a variable instead of a master item.

Then you still only have a single place to change it from if required but gives you the possibility of using within the color expression.

So create a variable that is the same expression as your master item ( i have called it vSalesVsTarget).

The master item can be deleted to avoid confusion.

In the expression use:

      $(vSalesVsTarget)

In the colour expression use:

      if($(vSalesVsTarget) <0 ,'#d01919','#545352')


I've attached your sample app where i've made these changes.


Hope this finally resolves your issue.


Thanks

Dan

paulyeo11
Master
Master
Author

Hi Daniel

Thank you very much for your sharing , now I know what the developer refer to when he said paste my expression in script.

Finally now i can start doing my KPI using developer extension.

Paul

Sent from my iPhone