Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Round off value incorrect

Hi QlikView users,

I would  like to seek help, I am having a problem on the rounding of of the values, I have a value of 1.5 which is derived from 1500000 divided by 1000 to get value in million then when on chart. I used the number format fixed to and integer the value shows the value of 1. I also then tried this solution, Round(Sum(Fieldname) *10/10,0.1) it got the correct answer, but it affected the other values.

Please help on how to round off correctly to integer.

Thanks in advance

Royce

29 Replies
marcus_sommer

If you want for different numbers a different rounding or formatting then you will need to set this within a nested-expression like: if(sum(value) > 1000000, round(sum(value), 1000), round(sum(value), 1))

Are there many conditions it will be performanter to replace the if with a pick(match()) lookup.

- Marcus

rubenmarin

Hi Royce, in that chart when it shows 1.5, I would try to add more decimals to the number format and check if really is a 1.5 or 1.4999999... many decimal numbers doesn't have an exact binary represantation and some decimal can be lost in conversion.

rubenmarin

Well, in a computer at the end all is binary, can be differences in how the results are managed, so far I know numbers in QV uses IEEE 754 standard.

You can check this post from HIC talking about Rounding Errors

Not applicable
Author

When I try to add more decimals, the value is 1.500000

Not applicable
Author

I already tried the one on the post, yes it showed correctly, but then the others values showed wrong. it happens the it does not apply correctly to all values.

rubenmarin

It would be heplfull if you can create a sample with only the numbers that demostrates the problem.

Not applicable
Author

That's the problem, when I try to recreate the numbers, it is showing correctly.

rubenmarin

You can create a copy of the document and scramble the data field by field, in document properties (CTRL+ALT+D):

There you can 'hide' customers, providers...

Also you can make selections the let only the data that demonstrates the problem and remove the rest of the data using 'Reduce Data' on the 'File' menu:

You think you can upload a sample with the issue using this?

Not applicable
Author

Hi All,

We just decided to let it be, but I think it is a bug in QlikView.

Thank you for all you help.

alibd225
Creator
Creator

Hope this will help you.

please see the attached file

ROUND.JPG