Home

DATESINPERIOD

DATESINPERIOD is a DAX function used in Power BI, Analysis Services, and Power Pivot to return a table of dates from a date column that fall within a specific period. The period is anchored at StartDate and spans a number of intervals at a chosen granularity such as day, week, month, quarter, or year.

Syntax: DATESINPERIOD (Dates, StartDate, NumberOfIntervals, Interval)

Parameters:

- Dates: a column of date values that defines the valid date domain, typically from a Date table.

- StartDate: a scalar date that serves as the anchor for the period.

- NumberOfIntervals: an integer specifying how many intervals to include. A negative value looks backward from StartDate;

- Interval: the interval granularity; options include DAY, WEEK, MONTH, QUARTER, or YEAR.

Return: a one-column table containing the dates from Dates that lie within the defined period, inclusive where

Usage notes: DATESINPERIOD is a common tool for time-intelligence calculations, enabling calculations such as “last N

Examples:

- Last 12 months ending at the latest date: CALCULATE(SUM(Sales[Amount]), DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -12, MONTH))

- Next 30 days from today: DATESINPERIOD('Date'[Date], TODAY(), 30, DAY)

a
positive
value
looks
forward.
applicable.
This
table
is
often
used
as
a
filter
in
measures
via
CALCULATE
or
similar
expressions.
months”
or
“next
N
days”
by
combining
it
with
a
measure.
It
relies
on
a
properly
configured
Date
table
and
is
frequently
paired
with
other
time-based
functions
like
CALCULATE,
DATESBETWEEN,
or
DATEADD
to
build
robust
period
analyses.