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

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
sunny_talwar

Try this:

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

View solution in original post

5 Replies
paulyeo11
Master
Master
Author

my qvf

sunny_talwar

What is the number you are expecting to see?

paulyeo11
Master
Master
Author

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

Sent from my iPhone

sunny_talwar

Try this:

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

paulyeo11
Master
Master
Author

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