Date.AddDays Function in Power Query M

Sumit Bansal
Written by

Sumit Bansal is the founder of TrumpExcel.com and a 13-time Microsoft Excel MVP. He started this site in 2013 to share his passion for Excel through easy tutorials, tips, and training videos, helping you master Excel, boost productivity, and maybe even enjoy spreadsheets!

The Date.AddDays function adds a number of days to a date and gives you the new date. Use a negative number and it goes back in time instead.

It’s what you use for due dates, delivery dates, follow-up dates, and “last 7 days” filters. In this article, I’ll show you how it works on single dates and whole columns, plus the few things that trip people up.

Follow along with the example file

Date.AddDays Function Examples.xlsx

Download

Date.AddDays Function Syntax

Date.AddDays(dateTime as any, numberOfDays as number) as any
  • dateTime – the date, datetime, or datetimezone value you want to add days to.
  • numberOfDays – the number of days to add. Use a negative number to subtract days. 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.AddDays Function

Use this function when you need to:

  • Calculate a due date, like 30 days after an invoice date
  • Add a different number of days to each row, such as a lead time stored in another column
  • Move a whole column of dates forward or back, for example when an event schedule is postponed
  • Set a deadline that keeps the time of day, like 3 days after a support ticket was opened
  • Filter rows to the last 7 or 30 days
  • Build a list of consecutive dates

Example 1: Add Days 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 10 days 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.AddDays(#date(2026,3,14),10)

Result: 3/24/2026

Date.AddDays(#date(2026,3,14),10) returns 3/24/2026

Here, #date(2026,3,14) creates the date March 14, 2026, and Date.AddDays adds 10 days to it. The result is a real date, so you can keep using it in other date calculations.

The result shows as 3/24/2026 because my computer uses US regional settings. On a computer set to English (United Kingdom), you’d see 24/03/2026, but it’s the same date.

You don’t have to worry about month ends or leap years either. For example, Date.AddDays(#date(2028,2,28),1) returns 2/29/2028, because 2028 is a leap year.

You might wonder why you can’t just write #date(2026,3,14) + 10. Power Query doesn’t let you add a plain number to a date, so that gives the error “We cannot apply operator + to types Date and Number.”

You can add a duration instead, like #date(2026,3,14) + #duration(10,0,0,0), which also returns 3/24/2026. But Date.AddDays is easier to read, because it says exactly what it’s doing.

Example 2: Subtract Days From a Date

Date.AddDays can also go backward.

Suppose you have the date March 14, 2026, and you want the date 30 days before it.

Create a new blank query (as in Example 1) and use this formula:

= Date.AddDays(#date(2026,3,14),-30)

Result: 2/12/2026

Date.AddDays with -30 returns 2/12/2026, 30 days before March 14, 2026

Here, the -30 tells Date.AddDays to go 30 days back from March 14, 2026. There’s no separate function for subtracting days, so a negative number is how you do it.

Example 3: Add a Due Date Column

In real data, you’ll usually work with a column of dates, not a single date.

Below is an Invoices table with the date each invoice was sent, and I want a due date 30 days later in a new Due Date column.

Invoices table with Invoice, Client and Invoice Date set to the Date type

To follow along, select any cell in the Invoices 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 Invoice Date header, pick Date, and choose Replace current. If you skip this, Date.AddDays keeps the Date/Time type, and every due date shows a time of 12:00:00 AM.

Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:

= Table.AddColumn(#"Changed Type","Due Date",each Date.AddDays([Invoice Date],30),type date)

Result: A new Due Date column shows 4/1/2026, 4/5/2026, 4/12/2026, 4/19/2026, and 4/26/2026.

New Due Date column 30 days after each invoice date

Here, the Table.AddColumn function adds the Due Date column, and the each keyword runs Date.AddDays on every row. [Invoice Date] picks the invoice date from the same row, and type date makes the new column a Date column.

Notice how the first invoice, sent on 3/2/2026, is due on 4/1/2026. Date.AddDays moves into the next month on its own.

Example 4: Add Days From Another Column

This next one comes up a lot with orders and deliveries.

Below is an Orders table with each order date and the number of days delivery takes, and I want the expected delivery date in a new Delivery Date column.

Orders table with Order ID, Order Date and Lead Time (Days)

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Order 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","Delivery Date",each Date.AddDays([Order Date],[#"Lead Time (Days)"]),type date)

Result: A new Delivery Date column shows 4/4/2026, 4/8/2026, 4/11/2026, 4/23/2026, and 4/17/2026.

New Delivery Date column adding each row's lead time to its order date

Here, the number of days comes from the Lead Time (Days) column, so each order gets its own number. ORD-501 adds 3 days to 4/1/2026, while ORD-502 adds 7 days to the same date.

The column name has spaces and parentheses in it, so it’s written as [#"Lead Time (Days)"]. The #"..." part lets Power Query read a name with special characters.

If a row has a blank lead time, Date.AddDays can’t add null days and that row shows the error “We cannot convert the value null to type Number.” So if your data can have blank lead times, make sure every row has a number (like 0) before you add the Delivery Date column.

Example 5: Shift a Whole Date Column

Sometimes you don’t need a new column. You just want to change the dates that are already there.

Below is a Workshops table with the date of each session, and every session has been postponed by a week, so I want the Session Date column to show the new dates.

Workshops table with Session, Room and Session Date

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Session 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.TransformColumns(#"Changed Type",{{"Session Date",each Date.AddDays(_,7),type date}})

Result: The Session Date column now shows 5/11/2026, 5/13/2026, 5/18/2026, 5/20/2026, and 5/25/2026.

Session Date column moved 7 days later with Table.TransformColumns

Here, the Table.TransformColumns function runs Date.AddDays on every value in the Session Date column and replaces it with the result. The _ stands for the current date in the column, so each one moves 7 days ahead.

Since the old dates are replaced, you won’t see them in the result anymore. If you want to keep both, use the Table.AddColumn function like in Example 3.

Example 6: Add Days to a Date and Time

Date.AddDays also works on values that have a time, and the time stays the same.

Below is a Tickets table with the date and time each support ticket was opened, and I want a response deadline 3 days later in a new Response Due column.

Tickets table with Ticket, Issue and the Opened At date and time

Load the table with Data > From Table/Range, as in Example 3. This time, keep the Opened At 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","Response Due",each Date.AddDays([Opened At],3),type datetime)

Result: A new Response Due column shows 3/12/2026 8:15:00 AM, 3/12/2026 1:40:00 PM, 3/13/2026 10:05:00 AM, 3/14/2026 4:30:00 PM, and 3/15/2026 9:45:00 PM.

New Response Due column 3 days after Opened At, with the same time

Here, Date.AddDays adds 3 days to each date and keeps the time exactly as it was. So TCK-2205, opened on 3/12/2026 at 9:45 PM, is due on 3/15/2026 at 9:45 PM.

The new column uses type datetime instead of type date, because the result still has a time in it. The same goes for datetimezone values, which keep their time zone offset too.

Example 7: Add Days When the Number Has Decimals

Date.AddDays only adds whole days, and that matters when the number of days comes from a calculation.

Below is a Rentals table with the pickup date and the number of hours each piece of equipment was rented for, and I want the date it’s due back in a new Return Date column.

Rentals table with Equipment, Pickup Date and Rental Hours

To turn the hours into days, you divide them by 24. But 36 hours is 1.5 days, and if you pass a decimal like that to Date.AddDays, you get an error instead of a date.

Important: A decimal number of days, like 1.5, gives the error “The number is out of range of a 32 bit integer value.” Round the number to a whole number before you pass it to Date.AddDays.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Pickup 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","Return Date",each Date.AddDays([Pickup Date],Number.RoundUp([Rental Hours] / 24)),type date)

Result: A new Return Date column shows 6/3/2026, 6/2/2026, 6/5/2026, 6/11/2026, and 6/12/2026.

New Return Date column using rental hours divided by 24 and rounded up

Here, [Rental Hours] / 24 turns the hours into days, and the Number.RoundUp function rounds them up to the next whole day. So the 36-hour rental (1.5 days) gets 2 days, and the 20-hour rental gets 1 day.

Rounding up makes sense here, because a rental that runs into another day isn’t back until that day.

Example 8: Filter Rows to the Last 7 Days

Date.AddDays is also handy inside a filter, where it works out the cutoff date for you.

Below is a Signups table with the date each member signed up, and I want to keep only the members who signed up in the 7 days up to March 31, 2026 (including March 31).

Signups table with Member and Signup Date from March 18 to March 31, 2026

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Signup 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.SelectRows(#"Changed Type",each [Signup Date] > Date.AddDays(#date(2026,3,31),-7))

Result: Only three rows are left: Chad Wilson (3/25/2026), Tiffany Brown (3/28/2026), and Claire Perry (3/31/2026).

Only the signups after March 24, 2026 remain

Here, Date.AddDays(#date(2026,3,31),-7) gives the cutoff date, 3/24/2026. The Table.SelectRows function keeps dates after the cutoff, which are March 25 through March 31 in this sample.

Oliver Williams signed up on 3/24/2026, the cutoff date itself, so that row is dropped. If you want 3/24/2026 included too (8 days in all), use >= instead of >.

The sample ends on March 31. If your data also contains later dates, add and [Signup Date] <= #date(2026,3,31) after the cutoff test and before the final closing parenthesis.

For a rolling seven-day window that includes today, replace #date(2026,3,31) in both tests with Date.From(DateTime.FixedLocalNow()). Date.From keeps only the date part.

Example 9: Create a List of Consecutive Dates

You can also use Date.AddDays to build a list of dates, which is useful for a weekly schedule or a small calendar.

Suppose you want all 7 dates of the week that starts on Monday, March 2, 2026.

Create a new blank query (as in Example 1) and use this formula:

= List.Transform({0..6},each Date.AddDays(#date(2026,3,2),_))

Result: A list of 7 dates, from 3/2/2026 to 3/8/2026.

List of 7 dates from 3/2/2026 to 3/8/2026

Here, {0..6} creates the numbers 0 to 6. The List.Transform function then goes through these numbers one at a time.

In this formula, _ is the current number, and Date.AddDays adds that many days to March 2, 2026. So 0 gives March 2, and 6 gives March 8.

The List.Dates function gives you the same list with List.Dates(#date(2026,3,2),7,#duration(1,0,0,0)), where the duration sets the gap between dates. Both work fine for evenly spaced dates.

With the Date.AddDays version, you change the numbers instead. For example, _*7 in place of _ adds 0, 7, 14 and so on, which gives the same weekday for 7 weeks.

Example 10: Move Weekend Dates to Monday

Date.AddDays counts every calendar day, including Saturdays and Sundays. This last example shows how to push a date that lands on a weekend to the next Monday.

Below is a Shipments table with the date each package was shipped, and I want a delivery date 5 days later in a new Delivery Date column, moved to Monday if it falls on a weekend.

Shipments table with Shipment and Ship Date

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Ship 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","Delivery Date",each
let
Arrival = Date.AddDays([Ship Date],5),
DayNumber = Date.DayOfWeek(Arrival,Day.Monday)
in
if DayNumber = 5 then Date.AddDays(Arrival,2)
else if DayNumber = 6 then Date.AddDays(Arrival,1)
else Arrival,type date)

Result: A new Delivery Date column shows 3/9/2026, 3/9/2026, 3/9/2026, 3/10/2026, and 3/11/2026.

New Delivery Date column, with weekend arrivals moved to Monday

Here, the let part sets up two values for each row. Arrival is the ship date plus 5 days, and DayNumber is the day of the week of Arrival.

The Date.DayOfWeek function with Day.Monday counts Monday as 0, so Saturday is 5 and Sunday is 6. The if after in decides which date each row gets.

If Arrival is a Saturday, the formula adds 2 more days, and if it’s a Sunday, it adds 1, so both land on Monday. SHP-701 ships on Monday, 3/2/2026, and 5 days later is Saturday, 3/7/2026, so its delivery date moves to 3/9/2026.

Note that this isn’t the same as adding 5 working days. It adds 5 calendar days and only moves a weekend result to Monday, so SHP-702 (Tuesday, 3/3/2026) is delivered on Monday, 3/9/2026, not Tuesday, 3/10/2026.

Public holidays also count as normal days here, so you’d need a holiday list to skip those too.

Other Excel Articles You May Also Like:

All Power Query Functions

Sumit Bansal

Sumit Bansal

13x Microsoft Excel MVP

Hey! I'm Sumit Bansal, founder of trumpexcel.com and a Microsoft Excel MVP. I started this site in 2013 because I genuinely love Microsoft Excel (yes, really!) and wanted to share that passion through easy Excel tutorials, tips, and Excel training videos. My goal is straightforward: help you master Excel skills so you can work smarter, boost productivity, and maybe even enjoy spreadsheets along the way!

Get the FREE 51 Excel Tips Ebook

Enter your details and the free PDF is on its way to your inbox.

Hmm, that didn't go through. Please check your email and try again.

No spam. You'll also get my weekly Excel newsletter. Unsubscribe anytime.

Check your inbox!

The ebook is on its way to your email. It usually lands within a couple of minutes.