OpenBI Docs Buy

PREVIOUSYEAR

The dates of the year before the first date in the filter context (the year ending on 31 December, or on a date given).

Group: Time intelligence. Compatible with DAX.

Syntax

PREVIOUSYEAR ( <dates> [, <year_end_date>] )
ParameterTypeDescription
datesDatesA column of dates of the model, such as Sales[Month], or the name of a calendar defined in the model.
year_end_dateText
optional
The year's last day as month and day, such as "6-30" for a year that ends on 30 June; when left out, 31 December. Not used with a calendar, whose own years count.

Returns

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

Remarks

  • The whole previous year comes back, whatever part of the current year is selected.
  • With a year end, the years are those that end on it.
  • 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

The whole year before, from one month

From March 2026, all 261 business days of 2025.

EVALUATE
CALCULATETABLE (
    ROW (
        "Days", COUNTROWS ( PREVIOUSYEAR ( Prices[Date] ) ),
        "From", MINX ( PREVIOUSYEAR ( Prices[Date] ), Prices[Date] ),
        "To", MAXX ( PREVIOUSYEAR ( Prices[Date] ), Prices[Date] )
    ),
    Prices[Month] = DATE ( 2026, 3, 1 )
)
DaysFromTo
2612025-01-012025-12-31

Liters of the year before

The same total for every month of 2025: all of 2024.

EVALUATE
ADDCOLUMNS (
    DATESBETWEEN ( Sales[Month], DATE ( 2025, 1, 1 ), DATE ( 2025, 3, 1 ) ),
    "Liters", [Liters sold],
    "Year before", CALCULATE ( [Liters sold], PREVIOUSYEAR ( Sales[Month] ) )
)
ORDER BY Sales[Month]
Sales[Month]LitersYear before
2025-01-0144635586171
2025-02-0144831586171
2025-03-0143593586171

NEXTYEAR, SAMEPERIODLASTYEAR, PARALLELPERIOD, OPENINGBALANCEYEAR.

Last updated · OpenBI Studio 0.3.74