Date.IsInNextMonth is a Power Query M function that indicates whether the given date(time) value occurs during the next month, 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.IsInNextMonth( dateTime as any ) as nullable logical
Description
Date.IsInNextMonth tests whether a given value (of type date, datetime, or datetimezone) is in the next month relative to the current system date and time, excluding current month values.
Examples
Let’s explore two straightforward examples to understand how the Date.IsInNextMonth function works.
Checking for the Next Month in a Calendar Table
Imagine you have a calendar table and you want to add a column that indicates true
for dates that are in the next month. You can do this using the Date.IsInNextMonth function on your [Date]
column.
Date.IsInNextMonth( [Date] ) // Output depends on [Date] column
This expression returns true
for any date in the [Date]
column that falls within the next month.
For example, if today is July 6, 2024, this function will return true
for all rows with dates in August 2024. Here’s a screenshot showing this:
You can see that dates within the next month are marked with true
.
Using the Current Date and Time
To check if the month following the current date and time fall within the next month, you can use the following expression:
// Output: true
Date.IsInNextMonth( Date.AddMonths( DateTime.FixedLocalNow(), 1 ) )
Related functions
Other functions related to Date.IsInNextMonth are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy