Value.Multiply
ValueReturns the product of multiplying two values, with support for numbers and durations.
Syntax
Value.Multiply(value1 as any, value2 as any, optional precision as nullable number) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
value1 | any | Yes | The first value (number, duration, etc.). |
value2 | any | Yes | The second value to multiply by. |
precision | number | No | Controls floating-point precision. Defaults to Precision.Double. |
Return Value
any — The product of value1 and value2.
Remarks
Value.Multiply returns the product of value1 and value2. It is the **functional equivalent of the * operator** in M — Value.Multiply(a, b) produces the same result as a * b.
This function supports type coercion across compatible types:
- **number * number** — standard numeric multiplication, returning a number.
- **duration * number** — scales a duration by a numeric factor, returning a duration.
- **number * duration** — equivalent to duration * number.
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.
If the two values are of incompatible types (e.g., text * number), an error is raised.
Examples
Example 1: Calculate line totals from unit price and quantity
Table.AddColumn(
Table.SelectColumns(Table.FirstN(Sales, 5), {"OrderID", "Product", "UnitPrice", "Quantity"}),
"LineTotal", each Value.Multiply([UnitPrice], [Quantity]), type number
)Output
OrderID | Product | UnitPrice | Quantity | LineTotal | |
|---|---|---|---|---|---|
| 1 | 1 | Widget A | 25 | 4 | 100 |
| 2 | 2 | Gadget B | 50 | 2 | 100 |
| 3 | 3 | Widget C | 15 | 10 | 150 |
| 4 | 4 | Gadget D | 75 | 1 | 75 |
| 5 | 5 | Widget A | 25 | 2 | 50 |
Example 2: Scale a duration by a factor
Value.Multiply(#duration(0, 2, 0, 0), 3)Output
Result | |
|---|---|
| 1 | 0.06:00:00 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks