DATESINPERIOD Function (DAX)
How does the DATESINPERIOD function (DAX) work?
The 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 Formula Syntax
DATESINPERIOD(
<dates>,<start_date>,<number_of_intervals>,<interval>
)
How do you use the DATESINPERIOD function?
The DATESINPERIOD function is used for common date intervals such as months, quarters, and years. Also used together with CALCULATE function.
Related Blog Posts
Considerations when using the DATESINPERIOD function
The dates argument can be a reference to a date/time column.
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.
Related Video Tutorials
Formula examples using the DATESINPERIOD function
=CALCULATE(SUM(InternetSales_USD[SalesAmount_USD]),DATESINPERIOD(DateTime[DateKey],DATE(2007,08,24),-21,day))
= CALCULATE ( SUM (Sales [Sales Amount]), DATESINPERIOD (Sales[Date], DATE (2015,1,1),3, MONTH)
=CALCULATE( SUM(SaleDataJul1[Total Sales]), DATESINPERIOD( SaleDataJul1[Date], MIN(SaleDataJul1[Date]), 3, DAY ) )