Value.Subtract
Subtracts the second value from the first, 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.Subtract(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 difference: a number, a duration between two dates or times, or a date moved back; null when either value is null.
Remarks
- With
Precision.Decimalboth numbers are taken as the decimals Power Query shows for them (15 significant digits), the difference is worked out exactly, and the answer is the number nearest to it.
Examples
As doubles
Value.Subtract(0.3, 0.1)
0.19999999999999998
As decimals
Value.Subtract(0.3, 0.1, Precision.Decimal)
0.2
Days between two orders
Value.Subtract(#date(2024, 3, 15), #date(2024, 1, 1))
#duration(74, 0, 0, 0)