DATESINPERIOD
The dates from a start date over a number of days, months, quarters or years, forward or back (with a calendar, weeks too).
Group: Time intelligence. Compatible with DAX.
Syntax
DATESINPERIOD ( <dates>, <start_date>, <number_of_intervals>, <interval> [, <end_behavior>] )
| Parameter | Type | Description |
|---|---|---|
dates | Dates | A column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model. |
start_date | Date | The date the period is counted from; it is included. Blank: the column's first date. |
number_of_intervals | Whole number | How many intervals: forward from the start when positive, back to it when negative. Zero gives nothing. |
interval | Keyword | DAY, MONTH, QUARTER or YEAR; with a calendar that has weeks, WEEK too. |
end_behavior | Keyword optional | With a calendar only: PRECISE (when left out) keeps to the same place in the other period; ENDALIGNED makes a period's last date reach the other period's last date. |
Returns
Table. The column's dates in the period, the start date included.
Remarks
- Back one month from 15 September covers 16 August to 15 September: the date a month away is not included.
- Starting on the last day of a month, it counts whole months: back one month from 30 September is all of September.
- Like
DATESBETWEEN, it ignores the filter context on the column; the start date is oftenMAX ( column )of the current context, for a moving total. - Only dates the column holds come back.
Examples
The last seven days
Seven calendar days back from 14 October 2026: five business days.
EVALUATE
DATESINPERIOD ( Prices[Date], DATE ( 2026, 10, 14 ), -7, DAY )
ORDER BY Prices[Date]
| Prices[Date] |
|---|
| 2026-10-08 |
| 2026-10-09 |
| 2026-10-12 |
| 2026-10-13 |
| 2026-10-14 |
A moving three-month total
EVALUATE
SUMMARIZECOLUMNS (
Sales[Month],
FILTER ( VALUES ( Sales[Month] ), Sales[Month] >= DATE ( 2025, 6, 1 ) && Sales[Month] <= DATE ( 2025, 9, 1 ) ),
"Liters", [Liters sold],
"Last 3 months", CALCULATE ( [Liters sold], DATESINPERIOD ( Sales[Month], MAX ( Sales[Month] ), -3, MONTH ) )
)
ORDER BY Sales[Month]
| Sales[Month] | Liters | Last 3 months |
|---|---|---|
| 2025-06-01 | 59243 | 153009 |
| 2025-07-01 | 64419 | 173110 |
| 2025-08-01 | 59266 | 182928 |
| 2025-09-01 | 49761 | 173446 |
From a month's last day
EVALUATE
VAR Days = DATESINPERIOD ( Prices[Date], DATE ( 2026, 9, 30 ), -1, MONTH )
RETURN
ROW ( "Days", COUNTROWS ( Days ), "From", MINX ( Days, Prices[Date] ), "To", MAXX ( Days, Prices[Date] ) )
| Days | From | To |
|---|---|---|
| 22 | 2026-09-01 | 2026-09-30 |