Date.IsInNextNWeeks
DateReturns true if the date falls within the next N calendar weeks.
Syntax
Date.IsInNextNWeeks(dateTime as any, weeks as number) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | A date, datetime, or datetimezone value to test. |
weeks | number | Yes | The number of weeks ahead to include. Must be a positive integer. |
Return Value
logical — true if the date falls within the next N weeks after the current week, false otherwise.
Remarks
Date.IsInNextNWeeks returns true if the input date falls within the next N complete Sunday–Saturday calendar weeks after the current week. The current week itself is not included; use Date.IsInCurrentWeek to also match the current week. The function is re-evaluated on each query refresh.
Weeks are always Sunday-to-Saturday boundaries — there is no parameter to use Monday-based weeks. If your organization uses Monday-based weeks, build the filter manually using Date.StartOfWeek(Date.From(DateTime.LocalNow()), Day.Monday).
This function counts complete weeks, not a rolling 7-day window. For a rolling N-day window from tomorrow, use Date.IsInNextNDays(n * 7) instead.
Examples
Example 1: Find orders due in the next 2 weeks
Table.SelectRows(
Sales,
each Date.IsInNextNWeeks([OrderDate], 2)
)OrderID | CustomerName | OrderDate | |
|---|---|---|---|
| 1 | 43 | Alice | 3/15/2026 |
| 2 | 44 | Bob | 3/20/2026 |
Example 2: Flag orders due in the next 4 weeks
Table.AddColumn(
Sales,
"DueInNext4Weeks", each Date.IsInNextNWeeks([OrderDate], 4), type logical
)OrderID | OrderDate | DueInNext4Weeks | |
|---|---|---|---|
| 1 | 42 | 3/8/2026 | FALSE |
| 2 | 43 | 3/15/2026 | TRUE |
| 3 | 46 | 4/15/2026 | FALSE |
Example 3: Combine current and next 2 weeks for a 3-week window
Table.SelectRows(
Sales,
each Date.IsInCurrentWeek([OrderDate]) or Date.IsInNextNWeeks([OrderDate], 2)
)OrderID | CustomerName | OrderDate | |
|---|---|---|---|
| 1 | 42 | Charlie | 3/8/2026 |
| 2 | 43 | Alice | 3/15/2026 |
| 3 | 44 | Bob | 3/20/2026 |