DATESINPERIOD

The DATESINPERIOD function returns a set of dates starting from a certain day and covering n intervals of the indicated type backwards or forwards in time.

Syntax

DATESINPERIOD(
    dates,
    start_date,
    number_of_intervals,
    interval
)

Parameters
  • dates: Reference column containing dates.
  • start_date: Starting day to consider.
  • number_of_intervals: Integer that specifies the number of intervals to add or subtract from the start date.
  • interval: Interval to add or subtract: YEAR, QUARTER, MONTH or DAY.
Returned value

The DATESINPERIOD function returns a table.

Additional Information

If the number of intervals is positive, the indicated interval will be added to the start date that number of times. On the contrary, if it is negative it will be subtracted.

The interval to be considered should not be enclosed in quotation marks.

This DAX function cannot be used in DirectQuery mode.

Examples

This example calculates the sales made during the two weeks ending April 23, 2003 (the Sales measure sums the column of sales amounts):

DATESINPERIOD function. Example of use
Related functions
Category
Time intelligence
Submitted by admin on Fri, 01/04/2019 - 14:25