The Date.StartOfMonth function gives you the first day of the month for any date. You’d use it to group data by month, find the first day of the next or previous month, and build lists of months.
If you give it a date and time instead of a plain date, you get the first day of the month at midnight (12:00:00 AM). In this article, I’ll show you how that works and then the most common ways to use the function.
Follow along with the example file
Date.StartOfMonth Function Examples.xlsx
Date.StartOfMonth Function Syntax
Date.StartOfMonth(dateTime as any) as any
- dateTime – the date or datetime value you want the start of the month for.
What it returns – the start of the month that contains dateTime, as the same type you gave it.
For a date, that’s simply the first day of the month. For a datetime, it’s the first day of the month at 12:00:00 AM.
A datetimezone value also works, and the result keeps its time zone offset.
If dateTime is null, you get null back. If you give it text or a number, such as “2026-08-19”, you get the error “The Date value must contain the Date component.”, so convert the value to a date first.
When to Use the Date.StartOfMonth Function
Use this function when you need to:
- Get the first day of the month for a date
- Add a month start column to a table
- Total values by month, with the month start date as the label
- Find the first day of the next month
- Keep only the rows from last month
- Build a list of months between two dates
- Split a date range into one row for each month it covers
Example 1: Get the First Day of the Month for a Date
Let’s start with the simplest use of the function.
Suppose you have the date August 19, 2026, and you want the first day of that month.
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.StartOfMonth(#date(2026,8,19))
Result: 8/1/2026

Here, #date(2026,8,19) creates the date August 19, 2026, and Date.StartOfMonth returns August 1, 2026, the first day of August.
The date shows as 8/1/2026 because my computer uses US regional settings. On a computer set to UK settings, the same value shows as 01/08/2026, but it’s still the same date.
If you want the first day of the current month, give the function today’s date instead of a fixed one. Here’s how to get today’s date in Power Query.
And if you need the last day of the month instead, use the Date.EndOfMonth function, which works the same way.
Example 2: Use Date.StartOfMonth With a Date and Time
Now let’s see what happens when the value also has a time.
Suppose you have a date and time, August 19, 2026 at 3:45 PM, and you want the start of that month.
Create a new blank query (as in Example 1) and use this formula:
= Date.StartOfMonth(#datetime(2026,8,19,15,45,0))
Result: 8/1/2026 12:00:00 AM

Here, #datetime(2026,8,19,15,45,0) creates August 19, 2026 at 3:45 PM. Since the input has a time, Date.StartOfMonth returns a datetime too, set to the very first moment of August.
The 3:45 PM is gone. The time part is now 12:00:00 AM, which is midnight at the very start of August 1.
Note that this result is not equal to the date 8/1/2026, because Power Query never treats a datetime as equal to a date. So if you compare month starts or match them against another table, make sure both sides are the same type.
Example 3: Add a Month Start Column to a Table
In real data, you’ll usually want the month start for a whole column of dates.
Below is a SupportTickets table with the date each ticket was opened, and I want the first day of that month in a new Month Start column.

To follow along, select any cell in the SupportTickets 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.
If you leave the column as Date/Time, Date.StartOfMonth returns a date and time (12:00:00 AM on the first day, as in Example 2), not a plain date. So click the type icon in the Opened Date header, pick Date, and choose Replace current.
Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Month Start",each Date.StartOfMonth([Opened Date]),type date)
Result: A new Month Start column shows 1/1/2026, 1/1/2026, 2/1/2026, 3/1/2026, and 5/1/2026.

Here, the Table.AddColumn function adds the Month Start column, and the each keyword runs Date.StartOfMonth on every row. [Opened Date] picks the date from the same row, and type date makes the new column a Date column.
The first argument, #"Changed Type", is the name of the Changed Type step you just set up. So the new column is added to the table as it looks after that step.
Jacqueline’s ticket on 1/9/2026 and Vincent’s ticket on 1/27/2026 both get 1/1/2026, because they’re in the same month. Rachel’s ticket is already on the first day of February, so her month start is the same date, 2/1/2026.
Example 4: Total Values by Month
This is the most common reason to use Date.StartOfMonth. Once every row has its month start, you can group the rows by month.
Below is a Donations table with the date and amount of each donation, and I want the total donations for each month, labeled with the first day of the month.

As in Example 3, load the table with Data > From Table/Range. Make sure the Changed Type step sets the Donation Date column to the Date type and the Amount column to Decimal Number.
First, add a month start for each donation. Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Month Start",each Date.StartOfMonth([Donation Date]),type date)
Power Query names a step added this way Custom1, so right-click it in the Applied Steps pane, choose Rename, and call it Added Month Start. The next formula refers to it by that name.
Next, group the donations by that month start. Add another new step and use this formula:
= Table.Group(#"Added Month Start",{"Month Start"},{{"Total Donations",each List.Sum([Amount]),type number}})
Result: A table with Month Start and Total Donations columns, and three rows: 1/1/2026 with 425, 2/1/2026 with 180, and 3/1/2026 with 450.

Here, the first step gives every donation in the same month the same month start date. The Table.Group function then makes one row for each month start.
In the Table.Group formula, #"Added Month Start" is the step to group and {"Month Start"} is the column to group by. {{"Total Donations",each List.Sum([Amount]),type number}} creates a new Total Donations column, where the List.Sum function adds up the amounts in each month.
So the three January donations (150, 75, and 200) become one row for 1/1/2026 with 425.
A month start date works well as a month label because it’s a real date. It sorts in the right order and works with date filters, unlike month names such as “Jan” and “Feb”.
Example 5: Get the First Day of the Next Month
Date.StartOfMonth works well with the Date.AddMonths function when something starts on the first of a later month.
Below is a Subscriptions table with the date each customer signed up, and I want the date their first full billing month starts in a new Billing Start column. Billing always starts on the first day of the month after the signup.

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.AddColumn(#"Changed Type","Billing Start",each Date.StartOfMonth(Date.AddMonths([Signup Date],1)),type date)
Result: A new Billing Start column shows 2/1/2026, 3/1/2026, 4/1/2026, 7/1/2026, and 1/1/2027.

Here, the Date.AddMonths function first moves the signup date one month ahead. Then Date.StartOfMonth takes that new date back to the first day of its month.
So William, who signed up on 1/31/2026, moves to 2/28/2026 first and then to 2/1/2026. Deborah signed up on 12/15/2026, so her billing starts in the next year, on 1/1/2027.
Ashley signed up on 3/1/2026, the first day of March, and still gets 4/1/2026. That’s because the formula always picks the month after the signup, even when the signup is on the 1st.
To get the first day of the previous month instead, use -1 in place of 1 in the Date.AddMonths function.
Example 6: Keep Only the Rows From Last Month
A monthly report usually needs the rows from the previous full month, no matter which day you run it.
Below is a Deliveries table with the date of each delivery, and I want to keep only the deliveries from the month before the report date. The report is run on June 10, 2026, so that’s May 2026.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets the Delivery 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 [Delivery Date]>=Date.StartOfMonth(Date.AddMonths(#date(2026,6,10),-1)) and [Delivery Date]<Date.StartOfMonth(#date(2026,6,10)))
Result: Only three rows are left: DL-402 (5/1/2026), DL-403 (5/17/2026), and DL-404 (5/31/2026).

Here, Date.StartOfMonth(Date.AddMonths(#date(2026,6,10),-1)) gives 5/1/2026, the first day of last month. Date.StartOfMonth(#date(2026,6,10)) gives 6/1/2026, the first day of the report month.
The Table.SelectRows function then keeps the rows on or after May 1 and before June 1. So Renee’s delivery on 4/28/2026 and the two June deliveries are dropped.
Using “before the first day of this month” as the end point means you never have to work out how many days last month had. Derek’s delivery on 5/31/2026 stays in, because it’s before June 1.
If you want the filter to move with the calendar, replace both #date(2026,6,10) parts with Date.From(DateTime.LocalNow()), which gives today’s date. Then each refresh keeps the rows from the month before the current one.
Example 7: Create a List of Month Starts Between Two Dates
This one builds a list of all the months between two dates, which is handy for a monthly calendar or a list of months to fill in.
Suppose a project runs from March 18, 2026 to September 5, 2026, and you want the first day of every month it touches.
Create a new blank query (as in Example 1) and use this formula:
= List.Generate(()=>Date.StartOfMonth(#date(2026,3,18)),each _<=#date(2026,9,5),each Date.AddMonths(_,1))
Result: A list of 7 dates: 3/1/2026, 4/1/2026, 5/1/2026, 6/1/2026, 7/1/2026, 8/1/2026, and 9/1/2026.

Here, the List.Generate function has three parts. The first, ()=>Date.StartOfMonth(#date(2026,3,18)), gives the starting value, which is 3/1/2026.
The second part, each _<=#date(2026,9,5), keeps the list going while the date is on or before 9/5/2026. The third, each Date.AddMonths(_,1), moves to the next date by adding one month, and in both parts _ stands for the current date in the list.
Because of that “on or before 9/5/2026” test, it matters that the list starts from the month start. If you started from 3/18/2026 itself, the list would go 3/18, 4/18, and so on up to 8/18/2026.
The next step, 9/18/2026, is after 9/5/2026, so that list would stop with only 6 dates and miss September completely. Starting from 3/1/2026 means every step lands on the 1st, and 9/1/2026 is still before the end date.
To turn the list into a table you can load to a sheet, click To Table on the List Tools Transform tab.
Follow along with the example file
Date.StartOfMonth Function Examples.xlsx
Example 8: Create One Row for Each Month a Project Covers
Now let’s do the same thing for every row of a table.
Below is a Projects table with the start and end date of each project, and I want one row for each month the project runs, with the month start in a new Month column. This is useful when you plan budgets or staff by month.

As in Example 3, load the table with Data > From Table/Range, and make sure the Changed Type step sets both the Start Date and End Date columns to the Date type.
First, add a list of month starts to each project. Add a new step (by clicking on the fx icon next to the formula bar) and use this formula:
= Table.AddColumn(#"Changed Type","Month",each List.Generate(()=>Date.StartOfMonth([Start Date]),(m)=>m<=[End Date],(m)=>Date.AddMonths(m,1)),type {date})
Rename this step Added Months (right-click it in the Applied Steps pane and choose Rename), because the next formula refers to it by that name.
Next, expand the lists into rows. Add another new step and use this formula:
= Table.ExpandListColumn(#"Added Months","Month")
Result: Seven rows: Website Redesign for 1/1/2026, 2/1/2026, and 3/1/2026, Office Move for 4/1/2026, and Staff Training for 5/1/2026, 6/1/2026, and 7/1/2026.

Here, the first step uses the same List.Generate pattern as Example 7, but runs it on each row with that row’s Start Date and End Date.
The second and third parts are written as (m)=> instead of each, because each is already used for the row. So m does the job _ did in Example 7: it’s the current month start in the list.
The Table.ExpandListColumn function then turns each list into separate rows, repeating the project details on every row. type {date} in the first step tells Power Query the list holds dates, so the expanded Month column comes out with the Date type.
The Website Redesign project ends on 3/5/2026 and still gets a March row, because the March month start (3/1/2026) is before the end date. The Office Move starts and ends in April, so it gets just one row.
Other Excel Articles You May Also Like:
- Date.Month – Use Date.Month in Power Query M to get the month number from a date.
- Date.MonthName – Use Date.MonthName in Power Query M to get the month name from a date.
- Date.StartOfWeek – Use Date.StartOfWeek in Power Query M to get the first day of a week.
- Date.AddDays – Use Date.AddDays in Power Query M to add or subtract days from a date.
- Date.AddYears – Use Date.AddYears in Power Query M to add or subtract years from a date.
- List.Dates – Use List.Dates in Power Query M to generate a list of dates.
- Date.EndOfWeek – Use Date.EndOfWeek in Power Query M to get the last day of a week.
- DateTime.LocalNow – Use DateTime.LocalNow in Power Query M to get the current date and time.