Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

juan_escobar
Contributor

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!!!

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Round Offset

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
4 Replies
MVP
MVP

Re: Round Offset

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
juan_escobar
Contributor

Re: Round Offset

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!

MVP
MVP

Re: Round Offset

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
juan_escobar
Contributor

Re: Round Offset

Yes! Thank you very much!

Community Browser