Power QueryExercises

Date.EndOfMonth

Date function · By Tahir Nas · Examples run in our simulator · Published · Updated

Returns the last day of the month.

When to use it

Use it for month-end reporting dates, period keys and due dates that fall on the last day of a month. It handles month lengths and leap years for you.

Syntax

Date.EndOfMonth(dateTime as any) as any

Returns

A date on the last day of the month.

Example

Date.Day(Date.EndOfMonth(#date(2028, 2, 10)))

Result

29

Example: month-end key for every row

Grouping by the month-end date gives one key per month.

Date.ToText(Date.EndOfMonth(#date(2026, 4, 9)), "yyyy-MM-dd")

Result

2026-04-30

Both results are produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M, and checked on every build.

Good to know

Common mistakes

Exercises that use Date.EndOfMonth

Learn more

Related functions

Official documentation: Date.EndOfMonth on Microsoft Learn.