Date.IsInPreviousMonth

Date

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

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

Syntax

Date.IsInPreviousMonth(dateTime as any) as logical

Parameters

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

Return Value

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

Remarks

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

This is one of the most commonly used Date.IsIn* functions, typically used for month-over-month reporting — for example, comparing last month's revenue to the current month. It matches the full prior calendar month, from the first to the last day.

To compare against a broader range of prior months, use Date.IsInPreviousNMonths. To include the current month in the same filter, add or Date.IsInCurrentMonth([OrderDate]).

Examples

Example 1: Filter last month's orders

Table.SelectRows(
    Sales,
    each Date.IsInPreviousMonth([OrderDate])
)
Result
OrderID
OrderDate
1382/10/2026
2392/25/2026

Example 2: Flag last month's rows

Table.AddColumn(
    Sales,
    "IsLastMonth", each Date.IsInPreviousMonth([OrderDate]), type logical
)
Result
OrderID
OrderDate
IsLastMonth
1371/20/2026FALSE
2382/10/2026TRUE
3423/8/2026FALSE

Example 3: Tag rows with a period label for month-over-month comparison

Table.AddColumn(
    Sales,
    "Period",
    each
        if Date.IsInCurrentMonth([OrderDate]) then "Current Month"
        else if Date.IsInPreviousMonth([OrderDate]) then "Last Month"
        else "Other",
    type text
)
Result
OrderID
OrderDate
Period
1371/20/2026Other
2382/10/2026Last Month
3423/8/2026Current Month

Compatibility

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