Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts ,
I want to round nearest 10 value ...
How we can round nearest 10 value ?
Thanks,
Madhu
Hi,
PFA.
Regards,
Joshua.
=round(1234,10)
returns 1230, is that what you are after ?
Hi Madhu,
from the Qlik help file:
Andy
Round - script and chart function
Round() returns the result of rounding x up or down to the nearest multiple of step [+ offset]. The default value of offset is 0. The default value of step is 1.
If x is exactly in the middle of an interval, it is rounded upwards.
Syntax:
Round(x[, step[, offset]])
Return data type: numeric
If you are rounding a floating point number you may experience results that are erroneous. These mostly insignificant rounding errors are due to that floating point numbers are represented by a finite number of binary digits. That results in QlikView calculating with a number that is already rounded. If it is critical to have correct rounding, a workaround is to multiply the numbers to convert them to integers.
Examples and results:
Examples | Results |
---|---|
Round( 3.8 ) | Returns 4 |
Round( 3.8, 4 ) | Returns 4 |
Round( 2.5 ) | Returns 3. Rounded up because 2.5 is exactly half of the default step interval. |
Round( 2, 4 ) | Returns 4. Rounded up because 2 is exactly half of the step interval of 4. |
Round( 2, 6 ) | Returns 0. Rounded down because 2 is less than half of the step interval of 6. |
Round( 3.88 , 0.1 ) | Returns 3.9 |
Round( 3.88 , 5 ) | Returns 5 |
Round( 1.1 , 1 , 0.5 ) | Returns 1.5 |
There is also Ceil and Floor functions in case you want to alway go up (Ceil(Number, 10)) or down (Floor(Number,10))