Number.IntegerDivide
NumberPerforms integer (floor) division, returning the quotient without the remainder.
Syntax
Number.IntegerDivide(number1 as nullable number, number2 as nullable number, optional precision as nullable number) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
number1 | number | Yes | The dividend. |
number2 | number | Yes | The divisor. Must not be zero. |
precision | number | No | An optional precision value. Typically omitted; use Precision.Decimal for decimal-aware division. |
Return Value
number — The integer quotient of dividing number1 by number2.
Remarks
Number.IntegerDivide returns the integer quotient of dividing number1 by number2, discarding any remainder. For positive operands this is equivalent to Number.RoundDown(number1 / number2). It always truncates toward negative infinity (floor division), not toward zero — this is relevant when operands have different signs.
The remainder (what Number.IntegerDivide discards) can be obtained with Number.Mod. The two are complementary: (Number.IntegerDivide(a, b) * b) + Number.Mod(a, b) = a.
Dividing by zero raises a runtime error. If your data might contain zero divisors, guard with if [Divisor] = 0 then null else Number.IntegerDivide([Value], [Divisor]) or use try/otherwise.
The optional precision parameter accepts Precision.Decimal to perform decimal-aware division; for most use cases omit this parameter.
Common uses: bucketing quantities into fixed-size groups (Number.IntegerDivide(quantity, groupSize) * groupSize), computing whole time units from a total, and chunking data for batch processing.
Examples
Example 2: Split total days into full weeks and remaining days
let
TotalDays = 17,
Weeks = Number.IntegerDivide(TotalDays, 7),
Remaining = Number.Mod(TotalDays, 7)
in
#table({"Weeks", "RemainderDays"}, {{Weeks, Remaining}})The final output — a single-row table showing Weeks = 2 and RemainderDays = 3.
Weeks | RemainderDays | |
|---|---|---|
| 1 | 2 | 3 |
Example 3: Bucket order quantities into groups of 5
Table.AddColumn(
Table.SelectColumns(Table.FirstN(Sales, 5), {"OrderID", "CustomerName", "Quantity"}),
"QtyBucket",
each Number.IntegerDivide([Quantity], 5) * 5,
type number
)OrderID | CustomerName | Quantity | QtyBucket | |
|---|---|---|---|---|
| 1 | 1 | Alice | 4 | 0 |
| 2 | 2 | Bob | 2 | 0 |
| 3 | 3 | Charlie | 10 | 10 |
| 4 | 4 | Alice | 1 | 0 |
| 5 | 5 | Diana | 6 | 5 |