DATEADD

Updated on

DATEADD is a DAX function that moves a given set of dates by a specified interval.

Syntax

DATEADD(
   Dates,
   NumberOfIntervals,
   Interval
)
Argument Properties Description
Dates The name of a column containing dates or a one column table containing dates.
NumberOfIntervals The number of intervals to shift.
Interval One of: Day, Month, Quarter, Year.

Return Values

A table containing a single column of date values.

Remarks

The dates argument can be any of the following:

  • A reference to a date/time column,

  • A table expression that returns a single column of date/time values,

  • A Boolean expression that defines a single-column table of date/time values.

    Note

    Constraints on Boolean expressions are described in the topic, CALCULATE function.

  • If the number specified for number_of_intervals is positive, the dates in dates are moved forward in time; if the number is negative, the dates in dates are shifted back in time.

  • The interval parameter is an enumeration, not a set of strings; therefore values should not be enclosed in quotation marks. Also, the values: year, quarter, month, day should be spelled in full when using them.

  • The result table includes only dates that exist in the dates column.

  • If the dates in the current context do not form a contiguous interval, the function returns an error.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example – Shifting a set of dates

The following formula calculates dates that are one year before the dates in the current context.

= DATEADD(DateTime[DateKey],-1,year)

Other functions related to DATEADD are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/dateadd-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy