FLOOR
Takes a number down to a multiple of a step you give, such as whole pallets or quarter hours.
Group: Math. Compatible with DAX.
Syntax
FLOOR ( <number>, <significance> )
| Parameter | Type | Description |
number | Number | The number to take down to a multiple. |
significance | Number | The multiple to round to, such as 1, 0.25 or 8; not zero. |
Returns
Number. The number rounded down to a multiple of the significance (see the remarks for negative numbers).
- With a positive significance the number goes down, towards minus infinity:
FLOOR ( 4.7, 1 ) is 4 and FLOOR ( -4.7, 1 ) is -5.
- A negative number with a negative significance goes towards zero instead:
FLOOR ( -4.7, -1 ) is -4.
- A positive number with a negative significance is an error.
- A significance of 0, or a blank one, is a division by zero and an error, where
CEILING and MROUND give 0.
- A blank number gives BLANK.
- Floating point shows in some results:
FLOOR ( 1.234, 0.05 ) = 1.2 is FALSE, as the result is a hair above 1.2. Round it before comparing.
Examples
Full pallets of 8
EVALUATE
ADDCOLUMNS ( DATATABLE ( "Crates", INTEGER, { { 7 }, { 12 }, { 30 } } ), "On full pallets", FLOOR ( [Crates], 8 ) )
ORDER BY [Crates]
| Crates | On full pallets |
|---|
| 7 | 0 |
| 12 | 8 |
| 30 | 24 |
Negative numbers
EVALUATE
ROW (
"4.7 by 1", FLOOR ( 4.7, 1 ),
"-4.7 by 1", FLOOR ( -4.7, 1 ),
"-4.7 by -1", FLOOR ( -4.7, -1 )
)
| 4.7 by 1 | -4.7 by 1 | -4.7 by -1 |
|---|
| 4 | -5 | -4 |
Compare after rounding
EVALUATE
ROW (
"As it is", FLOOR ( 1.234, 0.05 ) = 1.2,
"Rounded", ROUND ( FLOOR ( 1.234, 0.05 ), 2 ) = 1.2
)
CEILING, MROUND, INT, ROUNDDOWN.
Last updated · OpenBI Studio 0.3.74