Date.IsInPreviousMonth
DateReturns true if the date falls in the previous calendar month.
Syntax
Date.IsInPreviousMonth(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 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])
)OrderID | OrderDate | |
|---|---|---|
| 1 | 38 | 2/10/2026 |
| 2 | 39 | 2/25/2026 |
Example 2: Flag last month's rows
Table.AddColumn(
Sales,
"IsLastMonth", each Date.IsInPreviousMonth([OrderDate]), type logical
)OrderID | OrderDate | IsLastMonth | |
|---|---|---|---|
| 1 | 37 | 1/20/2026 | FALSE |
| 2 | 38 | 2/10/2026 | TRUE |
| 3 | 42 | 3/8/2026 | FALSE |
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
)OrderID | OrderDate | Period | |
|---|---|---|---|
| 1 | 37 | 1/20/2026 | Other |
| 2 | 38 | 2/10/2026 | Last Month |
| 3 | 42 | 3/8/2026 | Current Month |