Date.IsInPreviousWeek

Date

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

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

Syntax

Date.IsInPreviousWeek(dateTime as any) as logical

Parameters

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

Return Value

logicaltrue 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])
)
Result
OrderID
OrderDate
1403/2/2026
2413/4/2026

Example 2: Flag last week's rows

Table.AddColumn(
    Sales,
    "IsLastWeek", each Date.IsInPreviousWeek([OrderDate]), type logical
)
Result
OrderID
OrderDate
IsLastWeek
1392/25/2026FALSE
2403/2/2026TRUE
3423/8/2026FALSE

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
)
Result
OrderID
OrderDate
WeekPeriod
1392/25/2026Other
2403/2/2026Last Week
3423/8/2026This Week

Compatibility

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