Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
moleroalonso
Contributor II
Contributor II

Num function behaviour

Hi,

I've applied Num function in this case num(((9.34 + 9.34 + 9.34 + 9.20 )/4),'#.##0,00') and the result is "9.30" but I expected "9.31" because the result of the operation result is "9.305". If I apply Num function to "9.305" the result is the expected, "9.31"


Why do it happens?

3 Replies
sunny_talwar

I think you should read about Rounding Errors in QlikView

Anonymous
Not applicable

if you moved average calculaton to other variable then passed that variable to num function then it is returning correct result.

let var0 = ((9.34 + 9.34 + 9.34 + 9.20 )/4);

let var1 = num($(var0),'#.##');

let var2= num(9.305,'#.##');

moleroalonso
Contributor II
Contributor II
Author

Thank for your answers.

I have applied this solution:

=num(((9.34 + 9.34 + 9.34 + 9.20 )/4) + 0.000001,'#.##0,00')

Add a very little number that forces to rounding