Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I know we use them for round off values, but in real time where these two helps? It has draw backs if we used on Time and Sales.
Hi Pandunallani,
You can use these function any where like for sum,time, date, sales.... it depends on the requirement of business/report.
Some time users wants that if time is 9.30 then it should be considered as 10 but some user wants to be 9 only , so always use these function according to the demand of users.
Thanks,
Hi,
In real time will use floor for date/time fields.
ceil(x [ , base [ , offset ]])
Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number.
Examples:
ceil( 2.4 ) returns 3
ceil( 2.6 ) returns 3
ceil( 3.88 , 0.1 ) returns 3.9
ceil( 3.88 , 5 ) returns 5
ceil( 1.1 , 1 , 0.5 ) returns 1.5
floor(x [ , base [ , offset ]])
Rounding of x downwards to the nearest multiple of base with an offset of offset. The result is a number.
Examples:
floor( 2.4 ) returns 2
floor( 2.6 ) returns 2
floor( 3.88 , 0.1 ) returns 3.8
floor( 3.88 , 5 ) returns 0
floor( 1.1 , 1 , 0.5 ) returns 0.5
can please share the drawbacks you identified with these functions
Hi,
Please get following details :
Ceil() rounds x up to the nearest multiple of step [+ offset]. The default value of offset is 0.Compare with the floor function, which rounds input numbers down.
Syntax:
Ceil(x[, step[, offset]])
Examples | Results |
---|---|
Ceil( 2.4 ) | Returns 3 |
Ceil( 2.6 ) | Returns 3 |
Ceil( 3.88 , 0.1 ) | Returns 3.9 |
Ceil( 3.88 , 5 ) | Returns 5 |
Floor() rounds x down to the nearest multiple of step [+ offset]. The default value of offset is 0.
Compare with the ceil function, which rounds input numbers up.
Syntax:
Floor(x[, step[, offset]])
Examples | Results |
---|---|
Floor( 2,4 ) | Returns 0 |
Floor( 4,2 ) | Returns 4 |
Floor( 3.88 , 0.1 ) | Returns 3.8 |
Floor( 3.88 , 5 ) | Returns 0 |
Floor( 1.1 , 1 ) | Returns 1 |
For more details please go through following link,
Floor ‒ QlikView and Ceil ‒ QlikView
Thanks,
Hi sasi,
Thanks on your response, what you said is absolutely correct. My point is here in what situations we need them in real time.
--> these useful in ceil( 1.1 , 1 , 0.5 ),floor( 1.1 , 1 , 0.5 ) means offset of offset cases?
-->in case if we take these functions on total sales or sum(sales) it showing total because each fractional value getting round off so it affect the total.
This is the reason i asked for real time scenario.
Regards
Pavan
Hi Pooja,
Thank u and i know that what you given information from qlik help, I am looking for some real time scenario in what situation we use them mostly.
Regards
Pavan
Hi Pandunallani,
In real scenario if you have some value like 9.4 so floor function will give you 9 and ceil function will give you 10.
Please go through following example.
Value | Floor(Value) | Ceil(Value) |
---|---|---|
1.2 | 1 | 2 |
2.3 | 2 | 3 |
4.5 | 4 | 5 |
6.5 | 6 | 7 |
Thanks,
In what cases i mean sales? time and date? totals? sum?
In that case it gives the result wrong na?
Hi Pandunallani,
You can use these function any where like for sum,time, date, sales.... it depends on the requirement of business/report.
Some time users wants that if time is 9.30 then it should be considered as 10 but some user wants to be 9 only , so always use these function according to the demand of users.
Thanks,
Does it affect on dates if I use it like date(floor(dateField))