Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DATESINPERIOD Function (DAX)

Returns a table that contains a column of dates that begins with the start_date and continues for the specified number_of_intervals.


DATESINPERIOD(<dates>,<start_date>,<number_of_intervals>,<interval>)

Term

Definition

dates

A column that contains dates.

start_date

A date expression.

number_of_intervals

An integer that specifies the number of intervals to add to or subtract from the dates.

interval

The interval by which to shift the dates. The value for interval can be one of the following: year, quarter, month, day

A table containing a single column of date values.

NoteNote

To understand more about how context affects the results of formulas, see Context in DAX Formulas.

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.

NoteNote

Constraints on Boolean expressions are described in the topic, CALCULATE Function (DAX).

If the number specified for number_of_intervals 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; therefore values 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 appear in the values of the underlying table column.

The following formula returns the Internet sales for the 21 days prior to August 24, 2003.

= CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),DATESINPERIOD(DateTime[DateKey],DATE(2003,08,24),-21,day))
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.