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: 
Not applicable

Rounding Issue Of Qlik

Hi All,

I have a scenario where i have converted decimals from DB to integers on application.

At one scenario,

DB – 128.5 is getting converted to

Dashboard- 128

Other Scenario,

DB-2670.5 is getting converted to 2671.

Any idea why qlik treats these two numbers differently?

Khushboo

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

khushboo Peswani wrote:

I have checked upto 5 decimals.

In my source data it is 128.500000 and 2670.500000.

Then you may need more decimals - I think QV numbers have a resolution of about 14 digits. Try an expression like

     =128.50 - DBvalue      -- you will see that you don't get an answer of zero, you will get a (very) small positive number.

Did you read this: Rounding Errors

It explains the rounding "error" problem in more detail.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

23 Replies
lironbaram
Partner - Master III
Partner - Master III

i don't think it's a qlik issue

probably you see in the db a round version of  real number

Not applicable
Author

Liron, Thanks for your answer.

But i am still on clear on the issue.

But for Qlik , both are .5 , so why different treatment for these two numbers?

qlikviewwizard
Master II
Master II

Hi,

Please change the number format as shown below:

Capture.JPG

sasiparupudi1
Master III
Master III

may be one is using floor and the other is using round?

can you attach a sample?

qlikviewwizard
Master II
Master II

Hi Khushboo,

Please attach the sample to demonstrate the issue? Thank you.

Not applicable
Author

Sample i cannot attach.

but both these values are from one single column from DB and also they have same number settings.

Both the number settings are integer.

Still one is rounding off other one is not?

Not applicable
Author

In case you want it to round it off to 2 decimal places and load from DB.Try Loading

Round(FieldName,.01) as FieldName 

Or if you want to round it off to next Integer like, 128.7 to 129 and 128.3 to 128- Try this

Round(FieldName,1) as FieldName


But please use Round( ) functions everywhere you are loading this field for uniformity.


Pallav

Not applicable
Author

Hi Pallavi,

Thanks for your reply.

But i cant use round functions everywhere in my dashboard.

My questions whats causing this issue. if the DB has values 128.5,2670.5 .How come one gets rounded off and other Does'nt?

Not applicable
Author

Probably it is loading from Db in with Decimals then rounding off on charts differently based on settings on Numbers tab. Make sure its is set to Integer or Decimal on charts based on your preference.

If you use Round() function in the loading script in the way I mentioned (while loading) and then check your Numbers tab for charts to show the field as an Integer, you should be good.

One can't be sure why it is happening, but it seems like Qlik is loading (while loading through script) a decimal data from db like ( 128.50) and it is rounding off differently on different charts based on your settings on 'Numbers' tab.

Pallav