What is the opposite of EOMONTH()? I am trying to find the beginning date of 12 months ago. Would it be EOMONTH(Current Date,12)-1?

Any direction would be great. TIA

4 Answers

To find the beginning of a month, go to the end of the month before and add a date to it (not sure if I understand the question)

Start of month one year ago = EOMONTH(TODAY(),-13)+1 
1

In general, the opposit function is STARTOFMONTH:

=STARTOFMONTH('Date'[Current Date]) 

If you want to get the first day of the month 12 months ago:

= STARTOFMONTH ( DATEADD ( 'Date'[Current Date], -12, MONTH ) ) 

This measure will return the first date of the same month a year ago (i.e., for 2018-09-22, it will return 2017-09-01). Current month is included, so you will get a total of 13 months. If you need only 12 months total:

 = STARTOFMONTH ( DATEADD ( 'Date'[Current Date], -11, MONTH ) ) 

If you are trying to compute something over a rolling 12 months period, this article should help: 12-month Rolling Average in DAX

3

In DAX, you could also use

= DATE(YEAR(Dates[Date])-1, MONTH(Dates[Date]), 1) 

This backs up one year, keeps the month, and returns the first day of that month.

There is no straight opposite function for EOMONTH() in DAX. But you can still use EOMONTH() to get the first date of a month.

Last date of a month

= EOMONTH(Leaves[LeaveStart] 

First date of a month

= EOMONTH(Leaves[LeaveStart],-1)+1 

You can also just use 1 in place of date to get first day of a month, like:

= DATE(YEAR(Leaves[LeaveStart]), MONTH(Leaves[LeaveStart]), 1) 

Please note that STARTOFMONTH() is opposite function for ENDOFMONTH() not for EOMONTH().

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy