AddMonths(startdate, n [, mode])

AddMonths in Power BI

AddMonths shifts a date by n months. EDATE (DAX) and Date.AddMonths (M) do the same with mode 0 semantics. Mode 1 (end-relative) needs a few extra lines. DAX DATEADD is not the same function.

Direct equivalent DAX Power Query

Short answer: Use EDATE(d, n) in DAX and Date.AddMonths(d, n) in M. Both clamp 31 January + 1 month to the end of February, like Qlik's default mode 0.

What it does in Qlik

AddMonths(startdate, n [, mode]) adds n months (negative to subtract). In mode 0 (default), the day number is kept where possible and clamped to the month's last day. In mode 1, for start dates on or after the 28th, the result keeps the same distance to the end of the month: 28 February 2026 + 2 months with mode 1 gives 30 April (in a leap year, 28 February is one day from the end, so it gives 29 April).

Qlik example

Qlik script
LOAD ContractStart,
     AddMonths(ContractStart, 12)    AS ContractEnd,
     AddMonths(ContractStart, -1, 1) AS PrevMonthEndRelative
FROM [lib://Data/contracts.qvd] (qvd);

Power BI equivalent

Mode 0 (default)

DAX
Contract end = EDATE ( Contracts[ContractStart], 12 )

Power Query

Power Query M
= Table.AddColumn(Source, "ContractEnd", each Date.AddMonths([ContractStart], 12), type date)

Mode 1 (relative to month end)

DAX
Prev month end-relative =
VAR d = Contracts[ContractStart]
VAR DaysToEnd = INT ( EOMONTH ( d, 0 ) - d )
RETURN
    IF ( DAY ( d ) >= 28, EOMONTH ( d, -1 ) - DaysToEnd, EDATE ( d, -1 ) )

Gotchas and behaviour differences

  • DATEADD in DAX is a table function for time intelligence (it shifts a set of dates in the filter context). It cannot add months to a single value.
  • Microsoft's EDATE documentation doesn't say what happens to a time part, so convert datetimes to dates first if the time matters. Date.AddMonths on a datetime keeps the time.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.