DateTime.IsInPreviousNMinutes

DateTime

Returns true if the datetime falls within the previous N clock minutes.

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

Syntax

DateTime.IsInPreviousNMinutes(dateTime as any, minutes as number) as logical

Parameters

NameTypeRequiredDescription
dateTimeanyYesA datetime or datetimezone value to test.
minutesnumberYesThe number of minutes back to include. Must be a positive integer.

Return Value

logicaltrue if the datetime falls within the N minutes before the current minute, false otherwise.

Remarks

DateTime.IsInPreviousNMinutes returns true if the input datetime or datetimezone value falls within the N complete clock minutes preceding the current minute. The current minute itself is not included; use DateTime.IsInCurrentMinute to also match the current minute. The function is re-evaluated on each query refresh.

Examples

Example 1: Filter events from the previous 15 minutes

Table.SelectRows(
    Events,
    each DateTime.IsInPreviousNMinutes([EventTime], 15)
)
Result
EventID
EventTime
1553/8/2026 10:18:00 AM
2583/8/2026 10:25:00 AM

Example 2: Flag events from the past 30 minutes

Table.AddColumn(
    Events,
    "InPrev30Min", each DateTime.IsInPreviousNMinutes([EventTime], 30), type logical
)
Result
EventID
EventTime
InPrev30Min
1503/8/2026 10:00:00 AMFALSE
2553/8/2026 10:18:00 AMTRUE
3603/8/2026 10:32:00 AMFALSE

Compatibility

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