Skip to main content
Version: I2024.2.x

DateAdd

Changes the specified date by the specified interval and number; for example, by adding three days.

note

DateAdd can be used in calculated measures.

Syntax

DateAdd(Interval, N, Date)

Parameters

Interval
The time interval to change the Date by. This parameter supports the following values:

  • yyyy: year
  • q: quarter
  • m: month
  • y: day of year
  • d: day
  • w: weekday
  • ww: week
  • h: hour
  • n: minute
  • s: second

N
The number of Interval to add to the Date; for example, three days. This value may be positive or negative, and can optionally be substituted with a measure.

Date
The date to change by the specified Interval and number. This value can optionally be substituted with a measure.

Example

The following example subtracts one day from 2007-07-05:

[DateCustom].[DateInt].[DayInt].&[`Year("2007-07-05T12:30:10")`]&[`Month("2007-07-05T12:30:10")`]&[`Day(DateAdd("d",-1,"2007-07-05T12:30:10"))`]

The following expression illustrates using DateAdd over a measure:

DATEADD("d", 1, [Measures].[MinOrderDate])