OpenBI Docs Buy

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> )
ParameterTypeDescription
start_dateDateThe date to start from.
monthsWhole numberHow 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 ) + 1 is the first day of the date's month, and DAY ( 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 monthNext monthMonth before
2024-01-312024-02-292023-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

EDATE, ENDOFMONTH, DATE, DAY.

Last updated · OpenBI Studio 0.3.74