Date.EndOfMonth

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

Returns the end of the month that contains dateTime.

  • dateTime: A date, datetime, or datetimezone value from which the end of the month is calculated

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

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-endofmonth
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.