Use the functions in this section to retrieve data relative to the current day, month, quarter, or year. Plan supports relative time period functions that help you analyze historical and future data by selecting a specified number of preceding or following time periods.
The LASTNDAY function returns a range of dates for the specified number of days preceding the current day. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
LASTNDAY(number_of_days)
number_of_days: The number of preceding days for which data is returned.Returns a range of dates for the specified number of preceding days.
LASTNDAY(45)
Returns the date range for the 45 days preceding the current day.

The LASTNMONTH function returns a range of dates for the specified number of months preceding the current month. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
LASTNMONTH(number_of_months)
number_of_months: The number of preceding months for which data is returned.Returns a range of dates for the specified number of preceding months.
LASTNMONTH(15)
Returns the date range for the 15 months preceding the current month.

The LASTNQTR function returns a range of dates for the specified number of quarters preceding the current quarter. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
LASTNQTR(number_of_quarters)
number_of_quarters: The number of preceding quarters for which data is returned.Returns a range of dates for the specified number of preceding quarters.
LASTNQTR(5)
Returns the date range for the 5 quarters preceding the current quarter. In the following example, it returns the sum of Sales from 2025 Q2 to 2026 Q2, which represents the five quarters preceding the current quarter (2026 Q3).

.png)
The LASTNYEAR function returns a range of dates for the specified number of years preceding the current year. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
LASTNYEAR(number_of_years)
number_of_years: The number of preceding years for which data is returned.Returns a range of dates for the specified number of preceding years.
LASTNYEAR(2)
Returns the date range for the 2 years preceding the current year.

The NEXTNDAY function returns a range of dates for the specified number of days following the current day. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
NEXTNDAY(number_of_days)
number_of_days: The number of following days for which data is returned.Returns a range of dates for the specified number of following days.
NEXTNDAY(45)
Returns the date range for the 45 days following the current day.

The NEXTNMONTH function returns a range of dates for the specified number of months following the current month. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
NEXTNMONTH(number_of_months)
number_of_months: The number of following months for which data is returned.Returns a range of dates for the specified number of following months.
NEXTNMONTH(4)
Returns the date range for the 4 months following the current month. For example, if the current month is July, it returns the aggregated sales for August, September, October, and November.

The NEXTNQTR function returns a range of dates for the specified number of quarters following the current quarter. Use this function with the SELECT.BYDATE function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
NEXTNQTR(number_of_quarters)
number_of_quarters: The number of following quarters for which data is returned.Returns a range of dates for the specified number of following quarters.
NEXTNQTR(2)
Returns the date range for the two quarters following the current quarter.

The NEXTNYEAR function returns a range of dates for the specified number of years following the current year. Use this function with the SELECT function and an aggregate function, such as SUM or AVERAGE, to retrieve and aggregate data over the returned date range.
NEXTNYEAR(number_of_years)
number_of_years: The number of following years for which data is returned.Returns a range of dates for the specified number of following years.
NEXTNYEAR(2)
Returns the date range for the two years following the current year.
