OpenBI Docs Buy

PREVIOUSMONTH

The dates of the month before the first date in the filter context.

Group: Time intelligence. Compatible with DAX.

Syntax

PREVIOUSMONTH ( <dates> )
ParameterTypeDescription
datesDatesA column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model.

Returns

Table. The dates the column holds in the month before the first date in the filter context.

Remarks

  • The whole previous month comes back, whatever part of the current month is selected; with a selection over several months, the month before the first.
  • Only dates the column holds come back: a date the move or the period lands on that the column lacks is left out, and when none is left the table is empty.
  • Given a column, it reads the dates visible in the current filter context; in a row context, such as ADDCOLUMNS, the row becomes a filter first, so each row sees its own dates.
  • Given a calendar instead of a column, it works on the calendar's own periods (fiscal years, retail months of four or five weeks, ISO weeks). A filter on a category the calendar does not define, such as a month on a calendar of weeks, can make the call an error.

Examples

Change against the month before

EVALUATE
ADDCOLUMNS (
    DATESBETWEEN ( Sales[Month], DATE ( 2025, 2, 1 ), DATE ( 2025, 5, 1 ) ),
    "Liters", [Liters sold],
    "Change", [Liters sold] - CALCULATE ( [Liters sold], PREVIOUSMONTH ( Sales[Month] ) )
)
ORDER BY Sales[Month]
Sales[Month]LitersChange
2025-02-0144831196
2025-03-0143593-1238
2025-04-0144318725
2025-05-01494485130

The dates it returns

On Sales[Month] each month is a single date, its first.

EVALUATE
CALCULATETABLE (
    PREVIOUSMONTH ( Sales[Month] ),
    Sales[Month] = DATE ( 2025, 3, 1 )
)
Sales[Month]
2025-02-01

NEXTMONTH, PREVIOUSQUARTER, DATEADD, OPENINGBALANCEMONTH.

Last updated · OpenBI Studio 0.3.74