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
: Adate
,datetime
, ordatetimezone
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 ) )
Related articles
Learn more about Date.EndOfMonth in the following articles:
- Create Date Table or Calendar in Power Query M
Learn how to create a dynamic calendar table in Power Query’s M language. Build your custom columns and claim your free Date Table Script. » Read more
Related functions
Other functions related to Date.EndOfMonth are:
