Date.IsInNextNMonths
DateReturns true if the date falls within the next N calendar months.
Syntax
Date.IsInNextNMonths(dateTime as any, months as number) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | A date, datetime, or datetimezone value to test. |
months | number | Yes | The number of months ahead to include. Must be a positive integer. |
Return Value
logical — true 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)
)OrderID | CustomerName | OrderDate | |
|---|---|---|---|
| 1 | 43 | Alice | 4/10/2026 |
| 2 | 44 | Bob | 5/18/2026 |
| 3 | 45 | Charlie | 6/25/2026 |
Example 2: Flag orders due in the next 6 months
Table.AddColumn(
Sales,
"DueInNext6Months", each Date.IsInNextNMonths([OrderDate], 6), type logical
)OrderID | OrderDate | DueInNext6Months | |
|---|---|---|---|
| 1 | 42 | 3/8/2026 | FALSE |
| 2 | 43 | 4/10/2026 | TRUE |
| 3 | 46 | 9/1/2026 | FALSE |
Example 3: Include current month and next 3 months together
Table.SelectRows(
Sales,
each Date.IsInCurrentMonth([OrderDate]) or Date.IsInNextNMonths([OrderDate], 3)
)OrderID | CustomerName | OrderDate | |
|---|---|---|---|
| 1 | 42 | Charlie | 3/8/2026 |
| 2 | 43 | Alice | 4/10/2026 |
| 3 | 44 | Bob | 5/18/2026 |
| 4 | 45 | Diana | 6/25/2026 |