Skip to main content
Version: Next

TimeStampAdd

Returns a timestamp calculated by adding N DateTimeParts (for example, three hours) to the specified timestamp.

note

TimeStampAdd can be used in calculated measures.

Syntax

TimeStampAdd(Timestamp, DateTimePart, N)

Parameters

Timestamp
The timestamp to add the specified number of DateTimeParts to. This value can optionally be substituted with a measure.

DateTimePart
The time interval to change the Timestamp by. This parameter supports the following values:

  • d: day
  • h: hour

N
The number of DateTimeParts to add to the Timestamp. This value can optionally be substituted with a measure.

Example

The following expression adds two days to 2008-04-09:

[DateCustom].[Retail445].[Reporting Day].&[TimestampAdd(FloorTime("2008-04-09T11:35:04.201103"), "d", 2)]

The following expression illustrates using TimeStampAdd over a measure:

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