Value.Add

Value

Returns the sum of two values, with support for numbers, durations, and date/time types.

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

Syntax

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

Parameters

NameTypeRequiredDescription
value1anyYesThe first value (number, duration, datetime, etc.).
value2anyYesThe second value to add.
precisionnumberNoControls floating-point precision. Defaults to Precision.Double.

Return Value

anyThe sum of value1 and value2.

Remarks

Value.Add returns the sum of value1 and value2. It is the functional equivalent of the + operator in M — Value.Add(a, b) produces the same result as a + b.

This function supports type coercion across compatible types:

  • number + number — standard numeric addition, returning a number.
  • duration + duration — adds two durations together, returning a duration.
  • datetime + duration — shifts a datetime forward by the given duration, returning a datetime.
  • date + duration — shifts a date forward by the given duration, returning a date.
  • time + duration — shifts a time forward by the given duration, returning a time.
  • datetimezone + duration — shifts a datetimezone forward by the given duration, returning a datetimezone.

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: Add numeric columns

Table.AddColumn(
    Table.SelectColumns(Table.FirstN(Sales, 5), {"OrderID", "Product", "UnitPrice"}),
    "WithShipping", each Value.Add([UnitPrice], 5), type number
)
Output
OrderID
Product
UnitPrice
WithShipping
11Widget A2530
22Gadget B5055
33Widget C1520
44Gadget D7580
55Widget A2530

Example 2: Add a duration to a date

Table.AddColumn(
    Table.SelectColumns(Table.FirstN(Sales, 4), {"OrderID", "OrderDate"}),
    "FollowUpDate", each Value.Add([OrderDate], #duration(30, 0, 0, 0)), type date
)
Output
OrderID
OrderDate
FollowUpDate
111/15/20242/14/2024
221/20/20242/19/2024
332/1/20243/2/2024
442/15/20243/16/2024

Example 3: Simple addition of two numbers

Value.Add(10, 25)
Output
Result
135

Compatibility

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