Date.IsInNextNQuarters Function in Power Query
The Date.IsInNextNQuarters function in Power Query indicates whether the given datetime value dateTime occurs during the next N full quarters, as determined by the current date and time on the system.
Syntax
Date.IsInNextNQuarters( dateTime as any, quarters as number ) as nullable logical
The function has the following parameters:
- dateTime: A
date
,datetime
, ordatetimezone
value to be evaluated. - quarters: The number of quarters to check.
Returns
- TRUE if dateTime falls within the next N full quarters.
- FALSE otherwise.
How It Works
- A quarter consists of 3 months:
- Q1 → January – March
- Q2 → April – June
- Q3 → July – September
- Q4 → October – December
- The function excludes the current quarter and only checks full upcoming quarters.
- It considers rolling quarters, meaning it does not reset at year-end.
Example: Let’s assume the current date is 3 April 2025. Let’s check whether the given date lies in the next two quarters.
Power Query M
let Source = Date.IsInNextNQuarters(#date(2025, 12, 31), 2) in Source
The output of the above code is true.
Example: Let’s assume the current date is 3 April 2025. Let’s check whether the given date lies in the next two quarters.
Power Query M
let Source = Date.IsInNextNQuarters(#date(2026, 1, 1), 2) 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 quarter.