DateTime.IsInPreviousSecond

DateTime

Returns true if the datetime falls in the previous clock second.

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

Syntax

DateTime.IsInPreviousSecond(dateTime as any) as logical

Parameters

NameTypeRequiredDescription
dateTimeanyYesA datetime or datetimezone value to test.

Return Value

logicaltrue if the datetime falls within the clock second immediately before the current second, false otherwise.

Remarks

DateTime.IsInPreviousSecond returns true if the input datetime or datetimezone value falls within the clock second immediately preceding the current second (as determined by DateTime.LocalNow()). The current second is not included. The function is re-evaluated on each query refresh.

Examples

Example 1: Filter events from the previous second

Table.SelectRows(
    Events,
    each DateTime.IsInPreviousSecond([EventTime])
)
Result
EventID
EventTime
1733/8/2026 10:32:44 AM
2743/8/2026 10:32:44 AM

Example 2: Flag previous-second events

Table.AddColumn(
    Events,
    "IsPreviousSecond", each DateTime.IsInPreviousSecond([EventTime]), type logical
)
Result
EventID
EventTime
IsPreviousSecond
1723/8/2026 10:32:43 AMFALSE
2733/8/2026 10:32:44 AMTRUE
3753/8/2026 10:32:45 AMFALSE

Compatibility

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