Date.AddDays

Date

Adds a specified number of days to a date value.

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

Syntax

Date.AddDays(dateTime as any, numberOfDays as number) as any

Parameters

NameTypeRequiredDescription
dateTimeanyYesThe date, datetime, or datetimezone value to add days to.
numberOfDaysnumberYesThe number of days to add. Use negative values to subtract days.

Return Value

anyThe date resulting from adding the specified number of days to the input date.

Remarks

Date.AddDays adds or subtracts a whole number of days from a date, datetime, or datetimezone value. Passing a negative numberOfDays subtracts days. The return type matches the input type.

Examples

Example 1: Add 30 days to each OrderDate

Table.AddColumn(
    Table.SelectColumns(
        Table.FirstN(Sales, 5),
        {"OrderID", "OrderDate"}
    ),
    "DueDate", each Date.AddDays([OrderDate], 30), type date
)
Result
OrderID
OrderDate
DueDate
111/15/20242/14/2024
221/18/20242/17/2024
332/1/20243/2/2024
442/10/20243/11/2024
553/5/20244/4/2024

Example 2: Subtract days from a date

#table(
    type table [OriginalDate = date, OneWeekEarlier = date],
    {{#date(2024, 3, 5), Date.AddDays(#date(2024, 3, 5), -7)}}
)
Result
OriginalDate
OneWeekEarlier
13/5/20242/27/2024

Compatibility

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