Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

paulyeo11
Valued Contributor II

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

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

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

9 Replies
paulyeo11
Valued Contributor II

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

My QV doc explain in more detail with graphic.

Highlighted
Partner
Partner

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

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

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

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
Valued Contributor II

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

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
Valued Contributor II

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

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

Partner
Partner

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

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
Valued Contributor II

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

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

Partner
Partner

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

Hi Paul,

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

Regards.

paulyeo11
Valued Contributor II

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

Hi Martyn

Just mark very helpful.

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