EDATE
A date moved by a number of months, its time dropped.
Group: Date and time. Compatible with DAX.
Syntax
EDATE ( <start_date>, <months> )
| Parameter | Type | Description |
|---|---|---|
start_date | Date | The date to move from. |
months | Whole number | How many months to move it; negative to go back. |
Returns
Date. The same day of the month, that many months away, at midnight.
Remarks
- When the month it lands in is shorter, the day becomes that month's last: a month after 31 January 2024 is 29 February 2024.
- The time of day is dropped.
- A decimal number of months is rounded: 1.5 moves two months on, −1.5 two months back.
- A blank date gives BLANK; a blank number of months counts as 0.
- Adding 30 days is not the same as adding a month: use EDATE when the calendar month matters.
Examples
Month ends and leap years
EVALUATE
ROW (
"31 Jan + 1", EDATE ( DATE ( 2024, 1, 31 ), 1 ),
"31 Mar - 1", EDATE ( DATE ( 2024, 3, 31 ), -1 ),
"28 Feb 2023 + 12", EDATE ( DATE ( 2023, 2, 28 ), 12 )
)
| 31 Jan + 1 | 31 Mar - 1 | 28 Feb 2023 + 12 |
|---|---|---|
| 2024-02-29 | 2024-02-29 | 2024-02-28 |
Six months before each maturity
EVALUATE
SELECTCOLUMNS (
Holdings,
"Bond", Holdings[Bond],
"Maturity", Holdings[Maturity],
"Six months before", EDATE ( Holdings[Maturity], -6 )
)
ORDER BY [Maturity]
| Bond | Maturity | Six months before |
|---|---|---|
| Government 2028 | 2028-03-02 | 2027-09-02 |
| Covered 2029 | 2029-06-20 | 2028-12-20 |
| Corporate 2030 | 2030-11-25 | 2030-05-25 |
| Municipal 2031 | 2031-09-01 | 2031-03-01 |
| Government 2033 | 2033-03-15 | 2032-09-15 |