How to use Date.IsInNextMonth in PowerQuery
The Problem
You want to dynamically be able to identify dates which are in the month after the current month. How do you do that in PowerQuery?
Well, the easiest way to do this is to use the Date.IsInNextMonth function.
The Video
- 00:27 - What other functions work in the same way as Date.IsInNextMonth?
- 00:48 - How does the function work and what are the parameters?
- 03:33 - Date.IsInNextMonth demonstration in Power BI
- 06:39 - Date.IsInNextMonth demo with Date.AddDays
Lesson Notes
Date.IsInNextMonth is a useful function that identifies dates in a table that are in the next month from the month that we’re currently in.
Not only that, but there’s four other functions that work in pretty much the same way:
Date.IsInNextDay – identifies dates that are tomorrow
Date.IsInNextWeek – identifies dates that are in the next week
Date.IsInNextQuarter – identifies dates that are in the next quarter
Date.IsInNextYear – identifies dates that are in the next year.
Using the function is very straightforward as there is only one parameter which is the date or column of dates that we want to check whether they are in the next month or not. The function will then run the check and then return a logical ‘True’ or ‘False’. Easy!
So to create a column checking whether another column of dates is in the next month or not:
- Go to the Add Column tab and click on Custom Column
- In the pop up menu type the name of your new column the New Column Name field
- In the Custom Column Formula box, write ‘Date.IsInNextMonth’ and then open the brackets. From there put in the name of the field where the dates you want to check are. Don’t forget the square brackets, and then close the surrounding round brackets.
Easy!