Date.IsInNextNDays Function in Power Query
The Date.IsInNextNDays function in Power Query indicates whether the given datetime value dateTime occurs during the next number of days, as determined by the current date and time on the system.
Syntax
Date.IsInNextNDays(dateTime as any, days as number) as nullable logical
The function has the following parameters:
- dateTime: A
date
,datetime
, ordatetimezone
value to be evaluated. - days: The number of upcoming days to check.
Returns:
- TRUE if dateTime falls within the next N days (excluding today).
- FALSE otherwise.
Example: Let’s assume the current date is 3 April 2025.
Power Query M
let Source = Date.IsInNextNDays(#date(2025, 4, 5), 1) in Source
The output of the above code is false.
Note: • This function will return false when passed a value that occurs within the current day.
• It checks whether dateTime falls within the range tomorrow to (today + N days).
• Does not include past dates.