EOMONTH DAX Function (Date and Time)

Returns the date in datetime format of the last day of the month before or after a specified number of months.

Syntax

EOMONTH ( <StartDate>, <Months> )
Parameter Attributes Description
StartDate

The start date in datetime format.

Months

The number of months before or after the start_date.

Return values

Scalar A single datetime value.

Remarks

Because there is no function SOMONTH to get the start of the month, the EOMONTH can be used to get the start of the month by subtracting one more month and adding one to the result, as shown in the examples.

» 2 related articles
» 1 related function

Examples

--  EDATE adds months to a date, 
--  EOMONTH does the same, and it also goes at the end of the month
EVALUATE
ADDCOLUMNS (
    TOPN ( 10, VALUES ( 'Date'[Date] ), 'Date'[Date], ASC ),
    "EDATE, +1", EDATE ( 'Date'[Date], +1 ),
    "EDATE, -1", EDATE ( 'Date'[Date], -1 ),
    "EOMONTH, 0", EOMONTH ( 'Date'[Date], 0 ),
    "EOMONTH, +1", EOMONTH ( 'Date'[Date], +1 ),
    "EOMONTH, -1", EOMONTH ( 'Date'[Date], -1 )
)
ORDER BY 'Date'[Date]
Date EDATE, +1 EDATE, -1 EOMONTH, 0 EOMONTH, +1 EOMONTH, -1
2005-01-01 2005-02-01 2004-12-01 2005-01-31 2005-02-28 2004-12-31
2005-01-02 2005-02-02 2004-12-02 2005-01-31 2005-02-28 2004-12-31
2005-01-03 2005-02-03 2004-12-03 2005-01-31 2005-02-28 2004-12-31
2005-01-04 2005-02-04 2004-12-04 2005-01-31 2005-02-28 2004-12-31
2005-01-05 2005-02-05 2004-12-05 2005-01-31 2005-02-28 2004-12-31
2005-01-06 2005-02-06 2004-12-06 2005-01-31 2005-02-28 2004-12-31
2005-01-07 2005-02-07 2004-12-07 2005-01-31 2005-02-28 2004-12-31
2005-01-08 2005-02-08 2004-12-08 2005-01-31 2005-02-28 2004-12-31
2005-01-09 2005-02-09 2004-12-09 2005-01-31 2005-02-28 2004-12-31
2005-01-10 2005-02-10 2004-12-10 2005-01-31 2005-02-28 2004-12-31
--  To get the beginning of a month, 
--  subtract one more month and add one to the result
EVALUATE
ADDCOLUMNS (
    TOPN ( 10, VALUES ( 'Date'[Date] ), 'Date'[Date], ASC ),
    "End current month", EOMONTH ( 'Date'[Date], 0 ),
    "End next month", EOMONTH ( 'Date'[Date], +1 ),
    "End prev. month", EOMONTH ( 'Date'[Date], -1 ),
    "Start current month", EOMONTH ( 'Date'[Date], -1 ) + 1,
    "Start next month", EOMONTH ( 'Date'[Date], 0 ) + 1,
    "Start prev. month", EOMONTH ( 'Date'[Date], -2 ) + 1
)
ORDER BY 'Date'[Date]
Date[Date] End current month End next month End prev. month Start current month Start next month Start prev. month
2005-01-01 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-02 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-03 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-04 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-05 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-06 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-07 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-08 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-09 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01
2005-01-10 2005-01-31 2005-02-28 2004-12-31 2005-01-01 2005-02-01 2004-12-01

Related articles

Learn more about EOMONTH in the following articles:

Related functions

Other related functions are:

Last update: Mar 13, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://docs.microsoft.com/en-us/dax/eomonth-function-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of EOMONTH? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.