DAX DATEADD Function

Shift dates by a specified number of intervals in DAX.

DATEADD is a time intelligence function used to shift dates by a specified number of intervals (days, months, quarters, or years).

It returns a table of dates shifted forward or backward by the interval you specify.

Syntax

DATEADD(<dates>, <number_of_intervals>, <interval>)
  • <dates> : A column of dates, usually from a Date table.
  • <number_of_intervals> : Number of intervals to shift (positive or negative integer).
  • <interval> : Interval to shift by. Valid values: "DAY", "MONTH", "QUARTER", or "YEAR"

How It Works

  • If you use DATEADD with -1 and "YEAR", it returns the dates exactly 1 year before the dates in <dates>.
  • If you use DATEADD with 1 and "MONTH", it returns dates shifted forward by one month.

Example

Let's say you want to calculate Sales from the previous month:

Sales Previous Month :=
CALCULATE(
    [Total Sales],
    DATEADD('Date'[Date], -1, MONTH)
)
  • [Total Sales] is your existing measure.
  • 'Date'[Date] is your date column.
  • DATEADD shifts the date context by one month back.

Difference Between DATEADD and SAMEPERIODLASTYEAR

FunctionUse CaseKey Difference
DATEADDShift dates by any interval (day, month, quarter, year)More flexible intervals
SAMEPERIODLASTYEARShift dates exactly by one yearSpecifically for last year's same period
No questions available.