Date.IsInPreviousYear

Date

Returns true if the date falls in the previous calendar year.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Date.IsInPreviousYear(dateTime as any) as logical

Parameters

NameTypeRequiredDescription
dateTimeanyYesA date, datetime, or datetimezone value to test.

Return Value

logicaltrue if the date falls in the calendar year immediately before the current year, false otherwise.

Remarks

Date.IsInPreviousYear returns true if the input date falls anywhere within the calendar year immediately before the current year (as determined by DateTime.LocalNow()). For example, if today is in 2026, this function returns true for any date in 2025. The function is re-evaluated on each query refresh.

This is one of the most common Date.IsIn* functions for year-over-year reporting. It matches the full prior calendar year — January 1 through December 31. For multi-year historical windows, use Date.IsInPreviousNYears. To include the current year in the same filter, add or Date.IsInCurrentYear([OrderDate]).

Examples

Example 1: Filter last year's orders

Table.SelectRows(
    Sales,
    each Date.IsInPreviousYear([OrderDate])
)
Result
OrderID
OrderDate
1301/10/2025
23510/20/2025
33712/31/2025

Example 2: Flag last year's orders

Table.AddColumn(
    Sales,
    "IsLastYear", each Date.IsInPreviousYear([OrderDate]), type logical
)
Result
OrderID
OrderDate
IsLastYear
111/15/2024FALSE
2301/10/2025TRUE
3423/8/2026FALSE

Example 3: Add year-over-year period labels

Table.AddColumn(
    Sales,
    "YearPeriod",
    each
        if Date.IsInCurrentYear([OrderDate]) then "Current Year"
        else if Date.IsInPreviousYear([OrderDate]) then "Last Year"
        else "Other",
    type text
)
Result
OrderID
OrderDate
YearPeriod
111/15/2024Other
2301/10/2025Last Year
3423/8/2026Current Year

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks