Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use of Round function

hi,

Can anybody explain how does the Round function work?

please see the results i got below.

Round(3.88,0) = 1

Round(3.88,1) = 4

Round(3.88,2) = 4

Round(3.88,3) = 3

Round(3.88,4) = 4

Round(3.88,5) = 5

Round(3.88,6) = 6

Round(3.88,7) = 7

Round(3.88,8) = 0

Round(3.88,9) = 0

Round(3.88,10) = 0

Can you explain this?

Thanks

2 Replies
swuehl
MVP
MVP

Round to the closest multiple of your second argument (multiples are all integeres incl. zero), explains all of your results except first (multiple of zero doesn't makes sense, I assume result of 1 is a fixed logic).

Andrea_Ghirardello

In the QlikView help:


round (x [ , step [ , offset ]])


Rounding of x upwards or downwards n number of steps with an offset of offset. The result is a number. If x is exactly in the middle of an interval, it is rounded upwards. The function complies with the IEEE standard 64-bit floating point numbers.


Examples:

round( 2.4 ) returns 2

round( 2.6 ) returns 3

round( 2.5 ) returns 3

round( 3.88 , 0.1 ) returns 3.9

round( 3.88 , 5 ) returns 5

round( 1.1 , 1 , 0.5 ) returns 1.5