The EDATE function takes a date as an argument and returns the equivalent date a number of months before or after.
EDATE(
start_date,
months
)
- start_date: Reference date in datetime or text format.
- months: Integer (positive or negative) that represents the number of months to add or subtract from the start_date date.
The EDATE function returns a date in datetime format.
The EDATE function is frequently used to calculate an expiration date that occurs a certain number of months after another given date.
If the start_date date passed as an argument is in text format, the EDATE function uses the local date and time setting to interpret the string. This means that if the local representation of a date has the form "day/month/year", the text string "7/5/2016" will be interpreted as July 5, 2016. On the contrary, if the local representation of a date has the form "month/day/year", this text string would be interpreted as May 7, 2016.
If the referenced day does not exist (for example, if the starting date is January 31 and points to a month later, a month that only has 28 or 29 days), the function returns the last day of that month.
If the number of months specified as an argument is not an integer, it is rounded to the nearest integer.
In this first example we see the result of applying the function to different dates considering a number of both positive and negative months:
In this example, DAX interprets the text string "7/1/2016" as January 7, 2016, returning the date three months earlier: October 7, 2015.
Observe in the following image what is the result of applying the function (one month back and one month ahead in time) to various dates in early 2018. You can see how from January 29 to 31 the date returned for the following month is the 28th of February: