Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

where we use floor() and ceil() in qlikview?

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.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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,

View solution in original post

11 Replies
vardhancse
Specialist III
Specialist III

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

HirisH_V7
Master
Master

Hi,

Look this

ceil and floor functions

-Hirish

HirisH
“Aspire to Inspire before we Expire!”
Anonymous
Not applicable
Author

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]])

ExamplesResults

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]])

ExamplesResults

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,

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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.

ValueFloor(Value)Ceil(Value)
1.212
2.323
4.545
6.567

Thanks,

Anonymous
Not applicable
Author

In what cases i mean sales? time and date? totals? sum?

In that case it gives the result wrong na?

Anonymous
Not applicable
Author

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,

Shubham_Deshmukh
Specialist
Specialist

Does it affect on dates if I use it like date(floor(dateField))