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

Round Offset

Hello,

I was practicing some of the functions, and I found this "Round" function. It has an offset that I don't understand what is used for.

I attach an image with an example.

Round.png

Any clue, any explanation, I'll be glad!!!

Thanks!!!

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Juan

My understanding was that the offset is applied after the rounding. But after studying your example in your original post, this is what I think is happening.

     First the offset is being applied to the round precision to get the rounding points

          Around -7.4, these would be -6.7, -7.7 (the steps remain 1, but offset by 0.3)

     Then the value (-7.4) is being rounded to the nearest value (7.7)

Also look at 4.6

     The rounding points are 3.3, 4.3, 5.3 ... (step 1, offset by 0.3)

     The nearest rounding point is 4.3

Does that make it clearer?

Jonathan

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

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Juan

The first parameter is the rounding precision (1 rounds the nearest integer, 0.1 to the nearest 0.1, etc). The offset is an amount added to the rounded value after rounding (0 by default). I must admit that I have never used the offset in any QV model that I have developed.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Ok, I tryed this:

Round(-7.4, 1, 0.3)

so let me see if I got this stright; the idea of the offset is to modify in a way the steps at which the rounding is calculated....

so, for the former example, I would get -7 if no offset was added,,,,

but since 1-0.3 = 0.7, this would be the new step used to calculate the rounding.... then, -7.4 is closer to -7.7 than it is to -7....

Is my reasoning right here? thank you in advance!

jonathandienst
Partner - Champion III
Partner - Champion III

Juan

My understanding was that the offset is applied after the rounding. But after studying your example in your original post, this is what I think is happening.

     First the offset is being applied to the round precision to get the rounding points

          Around -7.4, these would be -6.7, -7.7 (the steps remain 1, but offset by 0.3)

     Then the value (-7.4) is being rounded to the nearest value (7.7)

Also look at 4.6

     The rounding points are 3.3, 4.3, 5.3 ... (step 1, offset by 0.3)

     The nearest rounding point is 4.3

Does that make it clearer?

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Yes! Thank you very much!