Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do I round all calculations to 2 decimal places

Hi,

Please could someone help as I have tried everything I can think of.

I am working in Qlik Sense with lots of data.

Unfortunately Qlik Sense is calculating my results by several decimal places and this is having a knock on effect to my overall calculations.

For example one of my calculations is 21.74 * 10.94 which should equal 237.84

Qlik Sense is calculating it as 21.7434736842105 * 10.94 giving me a result of 237.87

Please could someone advise how I get Qlik Sense to do all my calculations at 2 decimal spaces.

Many Thanks

Kind Regards

Wendy

5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Wendy,

All calculations are always performed at the maximum available precision, unless you round your numbers manually. So, basically you have 2 options:

1. Round the numbers during the data load:

     LOAD

     ...

     round(Price, 0.01) as Price,     // rounding

     ceil(Qty, 0.01)        as Qty,       // rounding up

...

2. Round the numbers in each calculation within each measure:

   round(Price, 0.01) * round(Qty, 0.01)

or

   ceil(Price, 0.01) * ceil (Qty, 0.01)

Cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming to Boston, MA this October!

petter
Partner - Champion III
Partner - Champion III

It is very common for many tools like Qlik Sense to use full precision on calculations.

However if you want to do rounding (use fewer decimal places) during calculations you could use the Round() function like this:

Round( Round( 21.7434736842105 , 0.01 ) * 10.94 , 0.01)

Which will give you 237.84

Round - script and chart function ‒ Qlik Sense

passionate
Specialist
Specialist

Try Using:

=num(Yourcaluculation,'#,##')

Anonymous
Not applicable
Author

Thank you Petter,

This works perfectly.

Kind Regards

Wendy

TS60
Contributor II
Contributor II

That isn't working for me.