Date.StartOfMonth
DateReturns the first day of the month for a given date.
Syntax
Date.StartOfMonth(dateTime as any) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | The date, datetime, or datetimezone value to find the start of the month for. |
Return Value
any — The first day of the month containing the input date.
Remarks
Date.StartOfMonth returns the first day of the month for the given date, datetime, or datetimezone value. The return type matches the input type. If the input is null, the function returns null.
Examples
Example 1: Find the start of each order's month
Table.AddColumn(
Table.SelectColumns(
Table.FirstN(Sales, 5),
{"OrderID", "OrderDate"}
),
"MonthStart", each Date.StartOfMonth([OrderDate]), type date
)Result
OrderID | OrderDate | MonthStart | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 | 1/1/2024 |
| 2 | 2 | 1/18/2024 | 1/1/2024 |
| 3 | 3 | 2/1/2024 | 2/1/2024 |
| 4 | 4 | 2/10/2024 | 2/1/2024 |
| 5 | 5 | 3/5/2024 | 3/1/2024 |
Example 2: Start of month from a scalar value
#table(
type table [Date = date, StartOfMonth = date],
{{#date(2024, 4, 15), Date.StartOfMonth(#date(2024, 4, 15))}}
)Result
Date | StartOfMonth | |
|---|---|---|
| 1 | 4/15/2024 | 4/1/2024 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks