OpenBI Docs Buy

EDATE

A date moved by a number of months, its time dropped.

Group: Date and time. Compatible with DAX.

Syntax

EDATE ( <start_date>, <months> )
ParameterTypeDescription
start_dateDateThe date to move from.
monthsWhole numberHow 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 + 131 Mar - 128 Feb 2023 + 12
2024-02-292024-02-292024-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]
BondMaturitySix months before
Government 20282028-03-022027-09-02
Covered 20292029-06-202028-12-20
Corporate 20302030-11-252030-05-25
Municipal 20312031-09-012031-03-01
Government 20332033-03-152032-09-15

EOMONTH, DATEADD, DATE, DATEDIFF.

Last updated · OpenBI Studio 0.3.74