EOMONTH
The last day of a month: the date's own, or one a number of months before or after it.
Group: Date and time. Compatible with DAX.
Syntax
EOMONTH ( <start_date>, <months> )
| Parameter | Type | Description |
|---|---|---|
start_date | Date | The date to start from. |
months | Whole number | How many months on (or back, when negative) the wanted month is; 0 for the date's own month. |
Returns
Date. The last day of that month, at midnight.
Remarks
- The time of day is dropped.
- A decimal number of months is rounded: 1.5 counts as 2.
- A blank date gives BLANK; a blank number of months counts as 0.
- Two patterns:
EOMONTH ( date, -1 ) + 1is the first day of the date's month, andDAY ( EOMONTH ( date, 0 ) )the number of days in it.
Examples
This month's end, the next one's and the one before
EVALUATE
ROW (
"This month", EOMONTH ( DATE ( 2024, 1, 15 ), 0 ),
"Next month", EOMONTH ( DATE ( 2024, 1, 15 ), 1 ),
"Month before", EOMONTH ( DATE ( 2024, 1, 15 ), -1 )
)
| This month | Next month | Month before |
|---|---|---|
| 2024-01-31 | 2024-02-29 | 2023-12-31 |
The first day of a date's month
The time of day goes with the rest.
EVALUATE
ROW ( "First day", EOMONTH ( DATE ( 2024, 3, 10 ) + TIME ( 9, 0, 0 ), -1 ) + 1 )
| First day |
|---|
| 2024-03-01 |
Related functions
EDATE, ENDOFMONTH, DATE, DAY.