DAX Function Guide

DATESINPERIOD
Empty image or helper icon

Sam McKay

CEO & Founder

How does the DATESINPERIOD 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?

The DATESINPERIOD function is used for common date intervals such as months, quarters, and years. Also used together with CALCULATE function.

Related Blog Posts

Loading

Considerations when using the DATESINPERIOD?

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: yearquartermonthday 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

Loading

Formula examples using the DATESINPERIOD

=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 ) )

Related Courses

Loading