Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Difference between two columns

Hi,

I facing an issue when I do simple subtraction like sum(A) - sum(B)

foe eg : sum A   Sum B          Total   it is not correct

             40            -35             75 

Please find attached sample application for validation.


Regards,

Srinath. !

5 Replies
sunny_talwar

Then do a straight sum

Sum(Sales) + Sum(Target)

You are subtracting a negative number which end up being added

Capture.PNG

sunny_talwar

Or may be this as it seems that target is sometimes positive and sometimes negative

Sum(Sales) - Sum(fabs(Target))

Not applicable
Author

Thanks you are grate...

Not applicable
Author

Sunny i got one Doubt

45 -40  out put should be -ve values i think so

sunny_talwar

45 - 40 should be negative??? Really? 45 is greater than 40 and if you subtract a smaller number from a larger number, you get a positive value. I am not sure what you are looking to get. May be you want to do Sum(Fabs(Target)) - Sum(Sales)? which will be 40 - 45... Is that what you want?