Date.IsInNextNWeeks

Updated on

Date.IsInNextNWeeks is a Power Query M function that indicates whether the given date(time) value occurs during the next number of weeks, as determined by the system. The function returns a boolean value (true or false).

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Date.IsInNextNWeeks(
   dateTime as any,
   weeks as number,
) as nullable logical

Description

Date.IsInNextNWeeks evaluates whether dateTime (of type date, datetime, or datetimezone) is within the next set number of weeks from the current system date and time, excluding the current week. The function also takes a weeks argument to define the number of weeks.

Examples

Determine if the week after the current system time is in the next two weeks.

// Output: true
Date.IsInNextNWeeks( Date.AddDays( DateTime.FixedLocalNow(), 7 ), 2 )

Other functions related to Date.IsInNextNWeeks are:

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-isinnextnweeks