# App Development

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for
Did you mean:
Partner

## Round the resut to two decimal

Hey Guys,

I am facing an issue on trying to fix my client data.

Here is the formula:

round(colA * colB / 100,0.01)

So I am expected to get my result in two decimals.

But this is what I get from Round function.

anything ends with 9, round-up work unexpected.

Labels (2)

• ### SaaS

1 Solution

Accepted Solutions
MVP

Might be, this link helps you.

https://community.qlik.com/t5/QlikView-App-Dev/Round-function-giving-sometimes-incorrect-results/td-...

ex: Round(0.595+ 0.0000000001,0.01)

Thanks & Regards,
Mayil Vahanan R
8 Replies
Partner

Hi @euriss_sow !

Try this

``num(ori_result,'#,##0.00') as result_new,``
MVP & Luminary

Qlik used a binary number-system. This means that many decimal-numbers haven't an exact binary equivalent. In your case the number 0.595 isn't available else the binary of it is a bit smaller and probably like this: 0.594970703 which then leads to your seen rounding. It's not really wrong.

- Marcus

Partner

One workaround is to perform rounding before division.

The expression should look like this :

round(colA*colB)/100

Thanks and regards,
Arthur Fong

Partner
Author

Hi Marcus,

The figure is exact 0.595.

Partner
Author
this I have tried before, I can get as two decimals but if I reuse this column for calculation. it will still count as 0.595.
MVP & Luminary

Not really, see: Rounding Errors - Qlik Community - 1468808

- Marcus

MVP

Might be, this link helps you.

https://community.qlik.com/t5/QlikView-App-Dev/Round-function-giving-sometimes-incorrect-results/td-...

ex: Round(0.595+ 0.0000000001,0.01)

Thanks & Regards,
Mayil Vahanan R
Partner
Author

We have tested with this formula

round(11.9*(5/100),0.01) = 0.60

round(11.9*5/100,0.01) = 0.59

what is the difference here?

Tags
Community Browser