Value.Divide
Divides the first value by the second, as the / operator does, in double or in decimal arithmetic.
Group: Values, types and errors. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Value.Divide(value1 as any, value2 as any, optional precision as nullable number) as any
| Parameter | Type | Description |
|---|---|---|
value1 | any | The first value: a number, or a date, time or duration. |
value2 | any | The second value. |
precision | nullable number optional | Precision.Double (the default) or Precision.Decimal. |
Returns
any. The quotient: a number, or a duration divided by a number; null when either value is null.
Remarks
- Dividing by zero gives infinity (or NaN for zero by zero), not an error, in either precision.
- With
Precision.Decimalboth numbers are taken as the decimals Power Query shows for them (15 significant digits), the quotient is worked out exactly, and the answer is the number nearest to it.
Examples
Units per box
Value.Divide(10, 4)
2.5
A price in øre
19.99 is not exact as a double; as decimals the division comes out even.
{Value.Divide(19.99, 0.01), Value.Divide(19.99, 0.01, Precision.Decimal)}
{1998.9999999999998, 1999}
By zero
Value.Divide(1, 0)
#infinity