Date.EndOfMonth

Updated on

Date.EndOfMonth is a Power Query M function that returns the end of the month. The function returns the end of the month as a date, datetime, or datetimezone value.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Date.EndOfMonth( dateTime as any ) as any

Description

Date.EndOfMonts returns the last day of the month for the provided date, datetime, or datetimezone value (dateTime).

Examples

Get the end of the month for 5/14/2011.

// Output: #date( 2011, 5, 31 )
Date.EndOfMonth( #date( 2011, 5, 14 ) )

Get the end of the month for 5/17/2011 05:00:00 PM -7:00.

// Output: #datetimezone( 2011, 5, 31, 23, 59, 59.9999999, -7, 0 )
Date.EndOfMonth( #datetimezone( 2011, 5, 17, 5, 0, 0, -7, 0 ) )

Learn more about Date.EndOfMonth in the following articles:

Other functions related to Date.EndOfMonth are:

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-endofmonth