Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
geertdeman
Contributor III
Contributor III

Floor function different result

can someone explain why floor(95/100,0.001) returns 95.0% and floor(57/60,0.001) teturns 94.9%  (format pattern for both is #,##0.0%) in a pivot table in qlik sense .  I would expect that both would return 95.0%

Labels (3)
3 Replies
tresesco
MVP
MVP

This is because of binary representation precision issue with floating point numbers. For better understanding, read this blog : https://community.qlik.com/t5/Qlik-Design-Blog/Rounding-Errors/ba-p/1468808

geertdeman
Contributor III
Contributor III
Author

can someone provide me an answer how I can solve this?

 

swuehl
MVP
MVP

As Henric mentioned in the blog post, you can use integers for all calculations, and only return to sub integers for display purposes at the very last step.

 

In your case, multiply both calculations with factor 1000.