DATEADD Function (DAX)

How does the DATEADD function (DAX) work?

The DATEADD function (DAX) returns a table that contains a column of dates, shifted either forward or backward in time by the specified number of intervals from the dates in the current context.

DATEADD Formula Syntax


How do you use the DATEADD function?

DATEADD function used to generate time comparisons over a range of different time frames. Allows you to compare a measure to any time period, you can look at other time periods such as day, month, or quarter.

It can be used also when calculating the Percentage change,Difference between time periods and Cumulative sales.

Related Blog Posts


Considerations when using the DATEADD function

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.

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: yearquartermonthday 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.

Related Video Tutorials

Formula examples using the DATEADD function


= DATEADD(Sales[Today’s Date],-1,DAY), 1, 0)

= CALCULATE( [Total Sales], DATEADD( Dates[Date], -1 ) )

Related Course Modules