Date.StartOfMonth

Date

Returns the first day of the month for a given date.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Date.StartOfMonth(dateTime as any) as any

Parameters

NameTypeRequiredDescription
dateTimeanyYesThe date, datetime, or datetimezone value to find the start of the month for.

Return Value

anyThe 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
111/15/20241/1/2024
221/18/20241/1/2024
332/1/20242/1/2024
442/10/20242/1/2024
553/5/20243/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
14/15/20244/1/2024

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks