Date.IsInNextNMonths

Date

Returns true if the date falls within the next N calendar months.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Date.IsInNextNMonths(dateTime as any, months as number) as logical

Parameters

NameTypeRequiredDescription
dateTimeanyYesA date, datetime, or datetimezone value to test.
monthsnumberYesThe number of months ahead to include. Must be a positive integer.

Return Value

logicaltrue if the date falls within the next N months after the current month, false otherwise.

Remarks

Date.IsInNextNMonths returns true if the input date falls within the next N complete calendar months after the current month. The current month itself is not included; use Date.IsInCurrentMonth to also match the current month. The function is re-evaluated on each query refresh.

For example, if today is in March and months = 3, it matches any date in April, May, or June. This function counts whole calendar months, not a rolling 30-day window — so the window always aligns to month boundaries.

To include the current month and the next N months in the same filter, combine with an or Date.IsInCurrentMonth expression. For a rolling day-based window instead, use Date.IsInNextNDays with an appropriate number of days.

Examples

Example 1: Find orders due in the next 3 months

Table.SelectRows(
    Sales,
    each Date.IsInNextNMonths([OrderDate], 3)
)
Result
OrderID
CustomerName
OrderDate
143Alice4/10/2026
244Bob5/18/2026
345Charlie6/25/2026

Example 2: Flag orders due in the next 6 months

Table.AddColumn(
    Sales,
    "DueInNext6Months", each Date.IsInNextNMonths([OrderDate], 6), type logical
)
Result
OrderID
OrderDate
DueInNext6Months
1423/8/2026FALSE
2434/10/2026TRUE
3469/1/2026FALSE

Example 3: Include current month and next 3 months together

Table.SelectRows(
    Sales,
    each Date.IsInCurrentMonth([OrderDate]) or Date.IsInNextNMonths([OrderDate], 3)
)
Result
OrderID
CustomerName
OrderDate
142Charlie3/8/2026
243Alice4/10/2026
344Bob5/18/2026
445Diana6/25/2026

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks