Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Possible to make black ground color Green when Amount is negative ?

Hi All

I have 2 table , each table have it correct color and wrong color :-

Table 1 Sales color correct. But Payroll Exp color wrong.

Table 2 Sales color Wrong. But Payroll Exp color Corect.

I aware the issue is cause by the Amount , if Amount is positive it will

Now For Table 3 , I Add a field = PLUS,display Green and if Amount is negative it will display Red.

Because system does not know the Amount is sales or Expense.

In order to let the system know the amount is sales or Expense , I add a new field = PLUS

So i hope that the color will display as below behavious :-

When  PLUS=P if Amount is positive make back ground color Green and Amount negative make color Red

When  PLUS=N if Amount is positive make back ground color Red and Amount negative make color Green.

Above is what i want , but i don't know how to start. Hope some one can advise me.

Paul

1 Solution

Accepted Solutions
Not applicable

Dear Paul,

Please see table 1 in the attached file. I have used the following syntax in your variance expression:

if(PLUS = 'P' and Column(3) >0 , Green(),

If(PLUS = 'N' and Column(3) < 0 , Green(), Red()))

This seems to be giving you the output you were after.

Regards


R

View solution in original post

9 Replies
paulyeo11
Master
Master
Author

My QV doc explain in more detail with graphic.

martynlloyd
Partner - Creator III
Partner - Creator III

Hi Paul,

It is very simple, instead of using Visual Cues, click on the little plus sign next to the expression and double click 'Background Color'.

Enter your IF statements, with results of LightRed() and LightGreen() accordingly...

Regards.

Not applicable

Dear Paul,

Please see table 1 in the attached file. I have used the following syntax in your variance expression:

if(PLUS = 'P' and Column(3) >0 , Green(),

If(PLUS = 'N' and Column(3) < 0 , Green(), Red()))

This seems to be giving you the output you were after.

Regards


R

paulyeo11
Master
Master
Author

Hi Martyn

Thank you vey much , you got the point , so i try to create expression as below , but it does not work. Hope you can advise me.

if(

PLUS='P',

(

COLUMN(2)-COLUMN(1))/COLUMN(1)>0,LightRed()

),

(

COLUMN(2)-COLUMN(1))/COLUMN(1)<0,LightGreen()

)

if(

PLUS='N',

(

COLUMN(2)-COLUMN(1))/COLUMN(1)>0,LightGreen()

),

(

COLUMN(2)-COLUMN(1))/COLUMN(1)<0,LightRed()

)

paulyeo11
Master
Master
Author

Hi Rahul

Thank you your expression working fine.

if(PLUS = 'P' and Column(3) <0 , lightGreen(),

If(PLUS = 'N' and Column(3) > 0 , lightGreen(), lightRed()))

Paul

martynlloyd
Partner - Creator III
Partner - Creator III

Hi Paul,

Sorry, was running a long script, you had some syntax errors with your nested IFs.

Did you find my first reply "Helpful"?

Marty.

paulyeo11
Master
Master
Author

Hi Martyn

Now i manage to solve it , the approach is same as your first reply. so i confirm your first reply is right approach. Rahul give me very simplify expression and working fine now.

Paul

martynlloyd
Partner - Creator III
Partner - Creator III

Hi Paul,

In that case, would you be happy to mark my reply as Helpful?

Regards.

paulyeo11
Master
Master
Author

Hi Martyn

Just mark very helpful.

Thank you very much.  As this issue is existed more then 1 yr.