Date.IsInNextNDays
DateReturns true if the date falls within the next N days (not including today).
Syntax
Date.IsInNextNDays(dateTime as any, days as number) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | A date, datetime, or datetimezone value to test. |
days | number | Yes | The number of days ahead to include. Must be a positive integer. |
Return Value
logical — true if the date falls within the next N days after today, false otherwise.
Remarks
Date.IsInNextNDays returns true if the input date falls between tomorrow and N days from today (inclusive). Today itself is not included; use Date.IsInCurrentDay if you also need to match today. The function is re-evaluated on each query refresh.
For example, with days = 7, it matches any date from tomorrow through 7 days from now — a 7-day window starting tomorrow and ending 7 days out. This is useful for "expiring soon" alerts, upcoming deadline views, or delivery windows.
Note the boundary behavior: Date.IsInNextNDays(d, 1) matches only tomorrow and is equivalent to Date.IsInNextDay. To include today in the window, add or Date.IsInCurrentDay([OrderDate]). For a full rolling window anchored to today (including today), consider computing [OrderDate] >= Date.From(DateTime.LocalNow()) and [OrderDate] <= Date.AddDays(Date.From(DateTime.LocalNow()), N).
Examples
Example 1: Find orders due in the next 7 days
Table.SelectRows(
Sales,
each Date.IsInNextNDays([OrderDate], 7)
)OrderID | CustomerName | OrderDate | |
|---|---|---|---|
| 1 | 43 | Alice | 3/9/2026 |
| 2 | 44 | Bob | 3/12/2026 |
Example 2: Flag orders expiring in the next 30 days
Table.AddColumn(
Sales,
"DueInNext30", each Date.IsInNextNDays([OrderDate], 30), type logical
)OrderID | OrderDate | DueInNext30 | |
|---|---|---|---|
| 1 | 42 | 3/8/2026 | FALSE |
| 2 | 43 | 3/9/2026 | TRUE |
| 3 | 44 | 4/7/2026 | TRUE |
| 4 | 45 | 5/1/2026 | FALSE |
Example 3: Include today in the next-N-days window
Table.SelectRows(
Sales,
each Date.IsInCurrentDay([OrderDate]) or Date.IsInNextNDays([OrderDate], 7)
)OrderID | CustomerName | OrderDate | |
|---|---|---|---|
| 1 | 42 | Charlie | 3/8/2026 |
| 2 | 43 | Alice | 3/9/2026 |
| 3 | 44 | Bob | 3/12/2026 |