Date.IsInPreviousYear
DateReturns true if the date falls in the previous calendar year.
Syntax
Date.IsInPreviousYear(dateTime as any) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | A date, datetime, or datetimezone value to test. |
Return Value
logical — true 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])
)OrderID | OrderDate | |
|---|---|---|
| 1 | 30 | 1/10/2025 |
| 2 | 35 | 10/20/2025 |
| 3 | 37 | 12/31/2025 |
Example 2: Flag last year's orders
Table.AddColumn(
Sales,
"IsLastYear", each Date.IsInPreviousYear([OrderDate]), type logical
)OrderID | OrderDate | IsLastYear | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 | FALSE |
| 2 | 30 | 1/10/2025 | TRUE |
| 3 | 42 | 3/8/2026 | FALSE |
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
)OrderID | OrderDate | YearPeriod | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 | Other |
| 2 | 30 | 1/10/2025 | Last Year |
| 3 | 42 | 3/8/2026 | Current Year |