Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
reporting_neu
Creator III
Creator III

Wrong addition / 1-1 = -1

Hi everyone,

I have the problem with some results. If I compare identical values, the value -0 appears instead of 0.

Example:
4,32 - 4,32 = -0

What can I do against it?

1 Solution

Accepted Solutions
mikaelsc
Specialist
Specialist

formatting a number will never change it's value; 

you should/could round, floor, ceil,... your values (eventually in your load script) , but ensure your rounding doesn't affect your (aggregated) results.

View solution in original post

4 Replies
Mario_ES
Contributor III
Contributor III

Hello,

If is a sum of two fields maybe they aren't identical values. Most of the times there's a small reminder that you can not see because of the number format. To solve this specify a format pattern that includes a format to display negative numbers without the - sign. For example #.0;#.0

reporting_neu
Creator III
Creator III
Author

Many thanks for your response.
I tried the following. Unfortunately it does not work.

Sum(Num([FO_OP.Sk_NotPayed], '#,#0')) - Sum(Num([FO_OP.Sk_Payed], '#,#0'))

or

Num(Sum([FO_OP.Sk_NotPayed]), '#,#0') - Num(Sum([FO_OP.Sk_Payed]), '#,#0')

or

Num(Num(Sum([FO_OP.Sk_NotPayed]), '#,#0') - Num(Sum([FO_OP.Sk_Payed]), '#,#0'), '#,#0')

The yellow marked field shows the value with formula. The field with the red border shows the value without a formula:

löschen.png

mikaelsc
Specialist
Specialist

formatting a number will never change it's value; 

you should/could round, floor, ceil,... your values (eventually in your load script) , but ensure your rounding doesn't affect your (aggregated) results.

reporting_neu
Creator III
Creator III
Author

Thank you. 

It works with Round(Value, 0.01).