Date.IsInPreviousWeek
DateReturns true if the date falls in the previous calendar week.
Syntax
Date.IsInPreviousWeek(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 Sunday–Saturday week immediately before the current week, false otherwise.
Remarks
Date.IsInPreviousWeek returns true if the input date falls within the Sunday–Saturday calendar week immediately preceding the current week. The current week is not included; use Date.IsInCurrentWeek to also match the current week. The function is re-evaluated on each query refresh.
The week boundary is always Sunday–Saturday. If your organization uses Monday-based weeks, build the filter manually using Date.StartOfWeek and Date.EndOfWeek with Day.Monday.
Use this function for week-over-week comparison dashboards, for identifying last week's shipments or activity, or as the "comparison period" when current week vs. previous week metrics are needed.
Examples
Example 1: Filter last week's orders
Table.SelectRows(
Sales,
each Date.IsInPreviousWeek([OrderDate])
)OrderID | OrderDate | |
|---|---|---|
| 1 | 40 | 3/2/2026 |
| 2 | 41 | 3/4/2026 |
Example 2: Flag last week's rows
Table.AddColumn(
Sales,
"IsLastWeek", each Date.IsInPreviousWeek([OrderDate]), type logical
)OrderID | OrderDate | IsLastWeek | |
|---|---|---|---|
| 1 | 39 | 2/25/2026 | FALSE |
| 2 | 40 | 3/2/2026 | TRUE |
| 3 | 42 | 3/8/2026 | FALSE |
Example 3: Add a week period label for week-over-week comparison
Table.AddColumn(
Sales,
"WeekPeriod",
each
if Date.IsInCurrentWeek([OrderDate]) then "This Week"
else if Date.IsInPreviousWeek([OrderDate]) then "Last Week"
else "Other",
type text
)OrderID | OrderDate | WeekPeriod | |
|---|---|---|---|
| 1 | 39 | 2/25/2026 | Other |
| 2 | 40 | 3/2/2026 | Last Week |
| 3 | 42 | 3/8/2026 | This Week |