DAX Time Intelligence - DATEADD function



Description

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.

Syntax

DATEADD (<dates>, <number_of_intervals>, <interval>) 

Parameters

Sr.No. Parameter & Description
1

dates

A column that contains dates.

2

number_of_intervals

A column that contains dates.

3

interval

The interval by which to shift the dates.

The value for interval can be one of the following −

  • Year
  • Quarter
  • Month
  • Day

Return Value

A table containing a single column of date values.

Remarks

The dates parameter 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.

Constraints on Boolean expressions −

  • The expression cannot reference a calculated field.

  • The expression cannot use CALCULATE function.

  • The expression cannot use any function that scans a table or returns a table, including aggregation functions.

However, a Boolean expression can use any function that looks up a single value, or that calculates a scalar value.

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

The interval parameter is an enumeration, not a set of strings. Hence, the values for interval 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 are specified in the dates parameter.

Example

= DATEADD (ProductInventory[InventoryDate],1, YEAR) 
dax_functions_time_intelligence.htm
Advertisements