Value.Divide

Value

Returns the result of dividing one value by another, with support for numbers and durations.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Value.Divide(value1 as any, value2 as any, optional precision as nullable number) as any

Parameters

NameTypeRequiredDescription
value1anyYesThe dividend (number, duration, etc.).
value2anyYesThe divisor.
precisionnumberNoControls floating-point precision. Defaults to Precision.Double.

Return Value

anyThe result of dividing value1 by value2.

Remarks

Value.Divide returns the result of dividing value1 by value2. It is the functional equivalent of the / operator in M — Value.Divide(a, b) produces the same result as a / b.

This function supports type coercion across compatible types:

  • number / number — standard numeric division, returning a number.
  • duration / number — divides a duration by a scalar, returning a shorter duration.
  • duration / duration — divides two durations, returning a number (the ratio).

The optional precision parameter controls floating-point precision for numeric operations. By default, Precision.Double is used. You can specify Precision.Decimal for higher-precision decimal arithmetic.

Division by zero raises an error. If the two values are of incompatible types, an error is raised.

Examples

Example 1: Calculate unit price from total and quantity

Table.AddColumn(
    Table.SelectColumns(Table.FirstN(Sales, 5), {"OrderID", "Product", "UnitPrice", "Quantity"}),
    "Computed", each Value.Divide([UnitPrice] * [Quantity], [Quantity]), type number
)
Output
OrderID
Product
UnitPrice
Quantity
Computed
11Widget A25425
22Gadget B50250
33Widget C151015
44Gadget D75175
55Widget A25225

Example 2: Divide a duration by a number

Value.Divide(#duration(10, 0, 0, 0), 4)
Output
Result
12.12:00:00

Example 3: Simple division of two numbers

Value.Divide(100, 4)
Output
Result
125

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks