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

what is round function

if i write this

      round(3.88,5)

it returns 5,6,7 it was executed...

when i return 8 it gives zero is answer what s the reason

4 Replies
Anonymous
Not applicable
Author

Hi kumar,

This is an extract from QlikView's reference manual:

Rounding of x upwards or downwards to the nearest multiple of base with an offset of offset. The result is a number. If x is exactly in the middle of an interval, it is rounded upwards.

So, it means that if you have:


round(3.88, 5)


you will get 5, because base is the number (or increments) that Qlik user to round the number. If you type:

round (6.5, 5)

You still get 5, because it's the nearest integer, but if you type

round(8.5, 5)

You get 10, because 5 is your base, that means that QlikView will round to nearest number multiple of 5. In the reference manual you can get more examples of how to use this function and the other parameters.

Hope it helps.

Karla

PrashantSangle

Hi,

In round()

your 1st parameter is Number which you want to round

and 2nd parameter is your base or you can say Interval which round up to.

for example in above example round(Number,5)    

Your base is in interval of 5 i.e. 0,5,10,15,20,25 and so on

so if you replace Number with

1)3.88     Output is nearest interval i.e     5          0<3.88<5

2)2.4     Output is nearest interval i.e     0          0<2.4<5

3)23     Output is nearest interval i.e     25          20<23<25

5)22     Output is nearest interval i.e     20          20<22<25

Hope you get how round() work.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
jagan
Luminary Alumni
Luminary Alumni

Hi Kumar,

Round() will rounds off to the nearest value.

For example

Round(0.2) - Gives 0, because nearest integer is 0 (because 0 is nearest -0.2, and 0.8 to 1 so it returns 0)

Round(0.7) - Gives 1, because nearest integer is 1

round(3.88,5) - Returns 5, here we are rounding off by 5, so nearest integer is 5.

round(1.88,5) - Returns 0, here we are rounding off by 5, so nearest integer is 0.

round(3.88,6) & round(3.88,7) - Returns 6 and 7 respectively, since the nearest integer is 6 and 7

round(3.88,8) - Returns 0, since nearest is 0 (i.e., -3.88,  wherease for 8 is 4.12 so it returns 0)


Hope this helps you in understanding the Round function.


Regards,

Jagan.


Not applicable
Author

Round function returns the nearest value as per your expectation in the function.

Sea the followings.


round(3.88, 5)


you will get 5, because base is the number (or increments) that Qlik user to round the number. If you type:

round (6.5, 5)

You still get 5, because it's the nearest integer, but if you type

round(8.5, 5)

You get 10, because 5 is your base, that means that QlikView will round to nearest number multiple of 5. In the reference manual you can get more examples of how to use this function and the other parameters.

Priyantha.