OpenBI Docs Buy

Value.Add

Adds two values the way 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.Add(value1 as any, value2 as any, optional precision as nullable number) as any
ParameterTypeDescription
value1anyThe first value: a number, or a date, time or duration.
value2anyThe second value.
precisionnullable number
optional
Precision.Double (the default) or Precision.Decimal.

Returns

any. The sum, of the kind + gives: a number, or a date or time moved by a duration; null when either value is null.

Remarks

  • With Precision.Decimal both numbers are taken as the decimals Power Query shows for them (15 significant digits), the sum is worked out exactly, and the answer is the number nearest to it.
  • A date, datetime or time plus a duration moves it; two durations add up. Text, lists and records can't be added: join them with &.

Examples

Two amounts as doubles

Value.Add(0.1, 0.2)
0.30000000000000004

The same amounts as decimals

Value.Add(0.1, 0.2, Precision.Decimal)
0.3

A delivery date two weeks on

Value.Add(#date(2024, 3, 15), #duration(14, 0, 0, 0))
#date(2024, 3, 29)

Value.Subtract, Value.Multiply, List.Sum, Value.Equals.

Last updated · OpenBI Studio 0.3.79