Downloads
Power Query MNumberIntermediate

Number.IntegerDivide

Divides one number by another and keeps only the whole number of times it fits.

Syntax
Number.IntegerDivide(number as nullable number, divisor as number, optional precision as any) as nullable number

Returns: The whole part of the division, or null when the input is null.

What it does

Number.IntegerDivide answers "how many complete units fit" without any decimal part. It is the whole number version of a division. Use it when a fraction makes no sense, such as the number of full pallets, full weeks, or complete installments. Pair it with Number.Mod to get the leftover.

Syntax and arguments

Example

A company pays a loan in full installments of 250 dollars. The question is how many full installments a balance covers, and how much is left over.

let
    Balance = 1080,
    Installment = 250,
    FullPayments = Number.IntegerDivide(Balance, Installment),
    Remainder = Number.Mod(Balance, Installment)
in
    {FullPayments, Remainder}

1080 divided by 250 gives 4 full installments, with 80 left over, so the result is {4, 80}. The remainder is the amount that does not make a full installment.

Example: a second, different use

Work out how many complete pallets of a given count fit into a shipment, and how many units are left for a partial pallet.

Things to watch

In business terms

Installments, pallets, billing units and full periods are whole quantities. Taking the whole part of a division makes the query say that directly, which is easier for a reviewer than a long division formula.

Related functions

All Power Query M functions · View as Markdown · M basics