The Date.AddMonths function adds a number of months to a date and gives you the new date. Give it a negative number and it goes back in time instead.
It’s what you use for renewal dates, contract end dates, next service dates, and “last 6 months” filters. In this article, I’ll show you how it works, including what happens when you add a month to a date like January 31.
Follow along with the example file
Date.AddMonths Function Examples.xlsx
Date.AddMonths Function Syntax
Date.AddMonths(dateTime as any, numberOfMonths as number) as any
- dateTime – the date, datetime, or datetimezone value you want to add months to.
- numberOfMonths – the number of months to add. Use a negative number to subtract months. It has to be a whole number.
What it returns – a value of the same type you gave it. A date gives you a date, and a datetime gives you a datetime with the same time of day.
If dateTime is null, you get null back instead of an error.
When to Use the Date.AddMonths Function
Use this function when you need to:
- Get the date a few months before or after a date
- Add a next due date column, like a service that’s due every 6 months
- Work out monthly renewal or billing dates, including for dates at the end of a month
- Add a different number of months to each row, using a number stored in another column
- Find the last day of a fixed-length term, like a 12-month contract
- Build a monthly schedule of dates
- Filter rows to the last few months
- Get the last day of the next month, together with Date.EndOfMonth
Example 1: Add Months to a Date
Let’s start with the simplest use of the function.
Suppose you have the date March 14, 2026, and you want the date that’s 3 months later.
Create a new blank query (in Excel, go to Data > Get Data > From Other Sources > Blank Query) and type this formula in the formula bar:
= Date.AddMonths(#date(2026,3,14),3)
Result: 6/14/2026

Here, #date(2026,3,14) creates the date March 14, 2026, and Date.AddMonths moves it 3 months ahead. The day stays the same (14), and only the month changes.
The result shows as 6/14/2026 because my computer uses US regional settings. Power Query shows dates in the order your computer’s regional settings use, so the same date may look different on your screen.
You might think adding 90 days would do the same job. It doesn’t, because months have different lengths, so Date.AddDays(#date(2026,3,14),90) lands on June 12, not June 14.
Example 2: Subtract Months From a Date
Date.AddMonths can also go backward.
Suppose you have the date March 14, 2026, and you want the date 6 months before it.
Create a new blank query (as in Example 1) and use this formula:
= Date.AddMonths(#date(2026,3,14),-6)
Result: 9/14/2025

Here, the -6 tells Date.AddMonths to go 6 months back from March 14, 2026. There’s no separate function for subtracting months, so a negative number is how you do it.
Notice that the result is in 2025. When you add or subtract months across a year boundary, the year changes on its own.
Example 3: Add a Next Due Date Column
In real data, you’ll usually work with a column of dates, not a single date.
Below is a Calibration table with the date each lab instrument was last calibrated, and I want the next calibration date, 6 months later, in a new Next Calibration column.

To follow along, select any cell in the Calibration table and go to Data > From Table/Range. Power Query adds a Changed Type step, and Excel dates usually come in there with the Date/Time type.
So click the type icon in the Last Calibrated header, pick Date, and choose Replace current. If you skip this, Date.AddMonths keeps the Date/Time type, and every new date shows a time of 12:00:00 AM.
The formula below starts from #"Changed Type", which is the name of that step. So the new column is added to the table after its types are set.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Next Calibration",each Date.AddMonths([Last Calibrated],6),type date)
Result: A new Next Calibration column shows 7/12/2026, 9/3/2026, 1/20/2027, 3/8/2027, and 5/25/2027.

Here, the Table.AddColumn function adds the Next Calibration column, and the each keyword runs Date.AddMonths on every row. [Last Calibrated] picks the date from the same row, and type date makes the new column a Date column.
The last three instruments were calibrated in the second half of 2026, so their next dates fall in 2027. For example, the thermometer calibrated on 7/20/2026 is due again on 1/20/2027.
Example 4: Add a Month to Dates at the End of a Month
Dates near the end of a month are where Date.AddMonths can surprise you, because not every month has a 29th, 30th, or 31st.
Below is a Subscriptions table with the date each monthly plan started, and I want the next billing date, one month later, in a new Next Billing column.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Start Date column to the Date type.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Next Billing",each Date.AddMonths([Start Date],1),type date)
Result: A new Next Billing column shows 2/15/2026, 2/28/2026, 2/28/2026, 2/28/2026, 4/30/2026, and 6/30/2026.

Here, the first account started on 1/15/2026, so its next billing date is simply 2/15/2026. But the next three started on January 29, 30, and 31, and February 2026 has only 28 days.
When the same day doesn’t exist in the new month, Date.AddMonths uses the last day of that month instead. So all three land on 2/28/2026, and the 3/31/2026 start becomes 4/30/2026, because April has 30 days.
In a leap year, February has 29 days, so the same rule gives 2/29 instead. For example, January 31, 2028 plus one month is 2/29/2028.
Note that Date.AddMonths keeps the day number when it can. It doesn’t remember that a date was a month end, so adding a month to 2/28/2026 gives 3/28/2026, not 3/31/2026.
This matters when you build a list of monthly dates, which you’ll see in Example 8.
Example 5: Add Months From Another Column
This next one comes up a lot when each row needs a different number of months.
Below is an Enrollments table with the date each student enrolled and the length of their course in months, and I want the date the course ends in a new Course Ends column.

As in Example 3, load the table with Data > From Table/Range. Make sure the Changed Type step sets Enrolled On to the Date type and Length (Months) to Whole Number.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Course Ends",each Date.AddMonths([Enrolled On],[#"Length (Months)"]),type date)
Result: A new Course Ends column shows 4/12/2026, 7/31/2026, 6/9/2026, 5/31/2026, and 2/28/2027.

Here, the number of months comes from the Length (Months) column, so each student gets their own end date. Logan’s 3-month course from 1/12/2026 ends on 4/12/2026, and Kelly’s 6-month course from 1/31/2026 ends on 7/31/2026.
Jasmine enrolled on 8/31/2026 for 6 months, and February 2027 has no 31st. So, as in Example 4, her course ends on the last day of February, 2/28/2027.
The column name has spaces and parentheses in it, so it’s written as [#"Length (Months)"]. The #"..." part lets Power Query read a name with special characters.
Important: Date.AddMonths only takes whole months. If you pass it a number with decimals, like 1.5, you get the error “The number is out of range of a 32 bit integer value.”
In this example you won’t see that error, because setting Length (Months) to Whole Number rounds every decimal first, without any warning. Halves go to the nearest even number, so 1.5 becomes 2 and 2.5 also becomes 2.
So if your lengths can have decimals, fix them in the source data before you load it, so each course gets the length you actually meant.
A blank length gives a different error, “We cannot convert the value null to type Number.” So fill in any blank lengths before you add the Course Ends column.
If you fill a blank with 0, Course Ends equals Enrolled On, because adding 0 months returns the same date. That looks like a real end date, so use the actual course length instead.
Follow along with the example file
Date.AddMonths Function Examples.xlsx
Example 6: Get the Last Day of a Term
Adding 12 months gives you the same date a year later. But for a contract that starts on January 1, the last day of the contract is December 31, not January 1 of the next year.
Below is a ServiceContracts table with the date each 12-month contract starts, and I want the last day of each contract in a new End Date column.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Start Date column to the Date type.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","End Date",each Date.AddDays(Date.AddMonths([Start Date],12),-1),type date)
Result: A new End Date column shows 12/31/2026, 3/14/2027, 4/30/2027, 7/30/2027, and 10/19/2027.

Here, Date.AddMonths first moves each start date 12 months ahead, and then the Date.AddDays function goes back one day. So the contract that starts on 1/1/2026 ends on 12/31/2026, which is exactly 12 months of service.
For a 12-month term, Date.AddYears([Start Date],1) would give the same date as adding 12 months. Date.AddMonths is the more flexible choice, because you can change 12 to 3, 6, or 18 for terms that aren’t whole years.
Example 7: Add Months to a Date and Time
Date.AddMonths also works on values that have a time, and the time stays the same.
Below is a Checkups table with the date and time of each patient’s last dental visit, and I want the next checkup, 6 months later, in a new Next Checkup column.

Load the table with Data > From Table/Range, as in Example 3. This time, keep the Last Visit column as Date/Time in the Changed Type step, because you want to keep the time.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Next Checkup",each Date.AddMonths([Last Visit],6),type datetime)
Result: A new Next Checkup column shows 8/10/2026 9:30:00 AM, 9/30/2026 2:00:00 PM, 11/18/2026 11:15:00 AM, 2/28/2027 4:45:00 PM, and 3/4/2027 8:00:00 AM.

Here, Date.AddMonths adds 6 months to each date and keeps the time exactly as it was. So Matthew Rogers, last seen on 2/10/2026 at 9:30 AM, gets a checkup slot on 8/10/2026 at 9:30 AM.
The month-end rule from Example 4 applies here too. Molly Martin’s visit on 8/31/2026 moves to 2/28/2027, and the 4:45 PM time doesn’t change.
The new column uses type datetime instead of type date, because the result still has a time in it. A datetimezone value works the same way and keeps its time zone offset too.
Example 8: Create a Monthly Schedule of Dates
You can also use Date.AddMonths to build a list of monthly dates, like payment dates for a plan that starts on January 31.
Suppose you want six monthly dates starting on January 31, 2026, with each date on the last day of its month.
Create a new blank query (as in Example 1) and use this formula:
= List.Transform({0..5},each Date.AddMonths(#date(2026,1,31),_))
Result: A list of 6 dates: 1/31/2026, 2/28/2026, 3/31/2026, 4/30/2026, 5/31/2026, and 6/30/2026.

Here, {0..5} creates the numbers 0 to 5, and the List.Transform function goes through them one at a time. In this formula, _ is the current number, so Date.AddMonths adds 0, 1, 2, and so on months to January 31.
Every date is worked out from January 31 itself, not from the date before it. That’s why March gets 3/31/2026, even though February’s date is 2/28/2026.
If you built the list by adding 1 month to the previous date instead, it would drift. Date.AddMonths(Date.AddMonths(#date(2026,1,31),1),1) gives 3/28/2026, because the second step starts from 2/28/2026, while Date.AddMonths(#date(2026,1,31),2) gives 3/31/2026.
This stays on month ends only because the schedule starts on the 31st. If it started on 4/30/2026, the dates would keep the 30th (5/30, 6/30, 7/30), so for that case wrap each date in the Date.EndOfMonth function, like List.Transform({0..5},each Date.EndOfMonth(Date.AddMonths(#date(2026,4,30),_))).
Example 9: Filter Rows to the Last 6 Months
Date.AddMonths is also handy inside a filter, where it works out the cutoff date for you.
Below is a Volunteers table with the date of each volunteer’s last shift, and I want to keep only the volunteers who worked a shift in the 6 months up to June 15, 2026.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Last Shift column to the Date type.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.SelectRows(#"Changed Type",each [Last Shift] >= Date.AddMonths(#date(2026,6,15),-6))
Result: Only three rows are left: Shelby Martin (12/15/2025), Brenda Owens (2/21/2026), and Carlos Bailey (5/30/2026).

Here, Date.AddMonths(#date(2026,6,15),-6) gives the cutoff date, 12/15/2025. The Table.SelectRows function then keeps the rows where the last shift is on or after that date.
Shelby Martin’s last shift was on 12/15/2025, the cutoff date itself, and the row stays because of the >= sign. If you use > instead, that row is dropped too.
This filter has no upper limit, so a shift dated after June 15, 2026 would also be kept.
To always filter the last 6 months from today, replace #date(2026,6,15) with Date.From(DateTime.LocalNow()), which gives today’s date in Power Query. The filter then moves forward every time you refresh the query.
Example 10: Get the Last Day of the Next Month
This last example combines Date.AddMonths with the Date.EndOfMonth function.
Below is a Commissions table with the date of each sale, and commissions are paid on the last day of the month after the sale, so I want that date in a new Payout Date column.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Sale Date column to the Date type.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Payout Date",each Date.EndOfMonth(Date.AddMonths([Sale Date],1)),type date)
Result: A new Payout Date column shows 2/28/2026, 2/28/2026, 3/31/2026, 4/30/2026, and 5/31/2026.

Here, Date.AddMonths moves each sale date one month ahead, and Date.EndOfMonth then gives the last day of that month. So Whitney’s sale on 1/8/2026 is paid on 2/28/2026, and Sarah’s sale on 2/14/2026 is paid on 3/31/2026.
The order of the two functions matters. If you wrote Date.AddMonths(Date.EndOfMonth([Sale Date]),1) instead, a sale on 2/14/2026 would get 3/28/2026, because the 28th from February carries into March.
Other Excel Articles You May Also Like:
- Date.Month
- Date.MonthName – Use Date.MonthName in Power Query M to get the month name from a date.
- Date.EndOfWeek – Use Date.EndOfWeek in Power Query M to get the last day of a week.
- List.Dates – Use List.Dates in Power Query M to generate a list of dates.
- DateTime.LocalNow – Use DateTime.LocalNow in Power Query M to get the current date and time.
- Date.Year – Use Date.Year in Power Query M to extract the year from a date.
- Date.ToText – Use Date.ToText in Power Query M to convert dates to text.
- Date.StartOfWeek – Use Date.StartOfWeek in Power Query M to get the first day of a week.