Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikmpate0
Creator II
Creator II

Expression returning -0

I have the following expression

(sum(alt(AMOUNT_DUE_REMAINING,0))-Sum(Alt(AMOUNT_APPLIED,0)))/1000

  

33
0
60
10,571
23
86
512
2,827
1,339

but if I change it to

sum(alt(AMOUNT_DUE_REMAINING,0))-Sum(Alt(AMOUNT_APPLIED,0))/1000

I get these  figures which are great because the zero figure on the second row is correct, although the rounding is missing on all figures. I have tried the round function but still the same values.

  

32,526
-117
59,925
10,571,403
22,975
85,759
512,471
2,827,071
1,338,635

Thanks much appreciated in advance.

10 Replies
MK_QSL
MVP
MVP

Provide sample data to check..

sasiparupudi1
Master III
Master III

Both of your expressions look same?

qlikmpate0
Creator II
Creator II
Author

The brackets are in different places

(sum(alt(AMOUNT_DUE_REMAINING,0))-Sum(Alt(AMOUNT_APPLIED,0)))/1000

VS

sum(alt(AMOUNT_DUE_REMAINING,0))-Sum(Alt(AMOUNT_APPLIED,0))/1000


qlikmpate0
Creator II
Creator II
Author

the data is part of a complex model and I cannot due to company policy also not too sure how to extract correctly for you to check.

sasiparupudi1
Master III
Master III

What is the expected output? the second table?

sunny_talwar

I think in your first expression you are dividing the subtraction of two expression by a 1000

(Expression1 - Expression2)/1000

and in expression 2, you are dividing just the expression2 by 100

Expression - (Expression/1000)

Now, I am not sure what you are trying to do... do you mind explaining what the goal is?

qlikmpate0
Creator II
Creator II
Author

the goal is to have the output like this

33
-117
60
10,571
23
86
512
2,827
1,339
MK_QSL
MVP
MVP

LOL... without knowing your data, how we can give you same output..???

sunny_talwar

Try this may be

If(

     (Sum(AMOUNT_DUE_REMAINING) - Sum(AMOUNT_APPLIED))/1000 = 0,

     -Sum(AMOUNT_APPLIED)/1000,

     (Sum(AMOUNT_DUE_REMAINING) - Sum(AMOUNT_APPLIED))/1000

)