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

round() function


hai guys,

  how to use round() function??

   plese give me script??

5 Replies
Not applicable
Author

example u have data like

sales:

100.23

200.34

300.55

then

to round the sales

round(sales) >round(100.23)> output is 100

round(300.55) > 301

sujeetsingh
Master III
Master III

floor(), ceil() [and not to forget round()] all have the same possible arguments:

ceil(x [ , base [ , offset ]])

Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number.

floor(x [ , base [ , offset ]])

Rounding of x downwards to the nearest multiple of base with an offset of offset. The result is a number.

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

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.

'x' is your input number. 'offset' is the number your intervals start from. base is the interval increment.

So ex2.floor( 1.1 , 1 , 0.5 ) creates intervals like [0.5, 1.5]; [1.5, 2.5]; [2.5, 3.5] ...

If your input is 1.1, the first interval is the matching one. floor() now returns the lower limit and ceil() the upper limit of the matching interval.

Hope this helps,

Not applicable
Author

round(2.4) - 2

round(2.6) -3

round(3.88,0.1) - 3.9

round(3.88,5) - 5

round(1.1,1,0.5) - 1.5

use as expression as the example

if(round(sales) > 3, round(3.88), round(3.88,0.1))

Anonymous
Not applicable
Author

Not applicable
Author

Hi vishnupriya ,

pls close this thread by marking correct and helpful answer