Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello.
I have some problems with the result of a rounding operation on a number.
If i put in a textbox
round(5.365,0.01). I get 5.37
Instead, if i put:
round(-5.365,0.01). I get -5.36
I expect as result -5.37 (as with a round operation in excel) instead of -5.36.
Why different result?🤔
Thanks in advance.
use this: round(-5.365,-0.01)
you need second parameter negative to round down and not up
Ok. but i don't know if the number is positive or negative.
I should insert an if statment. However is a strange beahviour.
if(x>0,round(x,0.01),round(x,-0.01))
Please have a look at the following Design Blog post, I believe it should shed some light upon things for you:
https://community.qlik.com/t5/Qlik-Design-Blog/Rounding-Errors/ba-p/1468808
The partner post is correct though, things are working as expected with the negative number, as I have run across this previously and run it by engineering, and they confirmed it is as expected behavior. Hopefully the post above will help you better understand things, and there are some suggestions on how to better handle things too, so hopefully you may find the right solution there too in order to get what you want.
Regards,
Brett