DateTime.IsInCurrentSecond
DateTimeReturns true if the datetime falls within the current second.
Syntax
DateTime.IsInCurrentSecond(dateTime as any) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
dateTime | any | Yes | A datetime or datetimezone value to test. |
Return Value
logical — true if the datetime falls within the current clock second, false otherwise.
Remarks
DateTime.IsInCurrentSecond returns true if the input datetime or datetimezone value falls within the same clock second as now (as determined by DateTime.LocalNow()). The second window spans HH:MM:SS.0000000 to HH:MM:SS.9999999. The function is re-evaluated on each query refresh.
Due to the precision of query evaluation timing, this function is primarily useful in high-frequency streaming or event-processing scenarios.
Examples
Example 1: Filter events from the current second
Table.SelectRows(
Events,
each DateTime.IsInCurrentSecond([EventTime])
)Result
EventID | EventTime | |
|---|---|---|
| 1 | 50 | 3/8/2026 10:32:45 AM |
| 2 | 51 | 3/8/2026 10:32:45 AM |
Example 2: Flag current-second rows
Table.AddColumn(
Events,
"IsCurrentSecond", each DateTime.IsInCurrentSecond([EventTime]), type logical
)Result
EventID | EventTime | IsCurrentSecond | |
|---|---|---|---|
| 1 | 49 | 3/8/2026 10:32:44 AM | FALSE |
| 2 | 50 | 3/8/2026 10:32:45 AM | TRUE |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks