Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

Hi All

when compute variable on net profit , i use to get this issue , this is due to net profit can be +ve and -ve changes.

I have below expression working fine , when LY +ve Value and CY also +Ve value :-


if((column(1)+column(2))=0,0,(if(fabs(column(1))=0,1,column(2) / column(1)-1)))

But when LY -ve amount CY +ve amount How to make it display +ve % , now it display -ve % which is not correct , because lst year lost money and CY make money , logical is +Ve , But in math it will compute -ve .

Now it display -706% (is correct if you manual cal ), how to make it display +706 % , Yet when LY +ve and CY +ve it also able to compute correct % ?

Paul


1 Solution

Accepted Solutions

Re: when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

Try this:

fabs(if((column(1)+column(2))=0, 0,(If(fabs(column(1)) = 0, 1, column(2) / column(1)-1))))

5 Replies
paulyeo11
Valued Contributor II

Re: when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

my qvf

Re: when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

What is the number you are expecting to see?

paulyeo11
Valued Contributor II

Re: when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

Can I request the Same % except the -ve sign change to +ve ?

Sent from my iPhone

Re: when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

Try this:

fabs(if((column(1)+column(2))=0, 0,(If(fabs(column(1)) = 0, 1, column(2) / column(1)-1))))

paulyeo11
Valued Contributor II

Re: when LY -ve amount CY +ve amount Vriable How to make it display +ve % ?

Wow you are the best. it work and not affect other.

Community Browser