Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

New Contributor II

Num function behaviour


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?

Tags (2)
3 Replies

Re: Num function behaviour

I think you should read about Rounding Errors in QlikView

New Contributor III

Re: Num function behaviour

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,'#.##');

New Contributor II

Re: Num function behaviour

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