Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Floor Function

Hi, I have a question about Floor Function. Could someone explain how Floor(3.5,-0.5) results in 4.0? I was thinking that it would result in 3.0

Any help will be greatly appreciated

10 Replies
Clever_Anjos
Employee
Employee

Into version 12 returns 3.5 that is consistent since you are passing a "step" parameter 0.5

If you want to floor to next integer use Floor(3.5)

Chanty4u
MVP
MVP

chk dis too

Try  = Floor(3.5)

Rounding Errors

jonathandienst
Partner - Champion III
Partner - Champion III

Floor Rounds down to the nearest multiple of the second parameter (to the precision of the second parameter).

Floor(3.6) -- > 3

Floor(3.6, 0.5) -- > 3.5

Floor(3.6, 0.1) --  > 3.6

(In all versions of QV that I have used)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi,

Refer to the following link :

Floor Function Details

Regards,

Snehal Nabar

jharke
Creator II
Creator II

Hello Rahul,

You use a Floor function (= kind of rounding down) with a minus-sign after the comma, that means that it is rounding up.

As a matter of fact, you use kind of Ceil(3.5,0.5).

(If you delete the minus sign, I think the result wil be 3.5)

(I wonder why the result of Floor(3.5,-0.5) would be 4. maybe 3.5 is a bit more, e.g. 3.5000001?)

Anonymous
Not applicable
Author

why we using Floor Function?

Clever_Anjos
Employee
Employee

I think floor is the topic, right?

Anonymous
Not applicable
Author

sure, floor is topic but which type of scenario can be use?

Clever_Anjos
Employee
Employee

Several cases:

  1. You have a frac number 4.678 for example and want to round to smallest 4
  2. You have a frac number 4.678 for example and want to round to smallest 4.6
  3. You have a datetime field and want to extract the date part   Date(Floor(yourfield))