DateTime.IsInNextHour
DateTimeReturns true if the datetime falls in the next clock hour.
Syntax
DateTime.IsInNextHour(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 clock hour immediately after the current hour, false otherwise.
Remarks
DateTime.IsInNextHour returns true if the input datetime or datetimezone value falls within the clock hour immediately following the current hour, as determined by DateTime.LocalNow(). For example, if it is currently 10:xx, this function returns true for any datetime between 11:00:00 and 11:59:59.9999999. The current hour itself is not included — use DateTime.IsInCurrentHour to also match the current hour. The function is re-evaluated on each query refresh.
Like all DateTime.IsIn* functions, this uses the local system clock as its reference. In Power BI Service and Dataflows, the "local" clock typically reflects UTC (the cloud region's system time), not your personal timezone. Keep this in mind when deploying solutions that use hour-level filtering in cloud-refresh scenarios.
DateTime.IsInNextHour is most practical in near-real-time or streaming scenarios where data is loaded continuously and you want to flag upcoming events or scheduled tasks within the next clock hour. For broader lookahead windows, use DateTime.IsInNextNHours.
Examples
Example 1: Filter events scheduled for the next hour
Table.SelectRows(
OrderLog,
each DateTime.IsInNextHour([Timestamp])
)LogID | OrderID | Action | Timestamp | DurationMinutes | Notes |
|---|
Example 2: Flag next-hour log entries
Table.AddColumn(
Table.SelectColumns(Table.FirstN(OrderLog, 4), {"LogID", "Timestamp"}),
"IsNextHour", each DateTime.IsInNextHour([Timestamp]), type logical
)LogID | Timestamp | IsNextHour | |
|---|---|---|---|
| 1 | L001 | 1/15/2024 9:30:00 AM | FALSE |
| 2 | L002 | 1/16/2024 2:15:00 PM | FALSE |
| 3 | L003 | 1/18/2024 11:00:00 AM | FALSE |
| 4 | L004 | 1/20/2024 8:45:00 AM | FALSE |
Example 3: Build a two-hour alert window (current + next hour)
Table.AddColumn(
Table.SelectColumns(Table.FirstN(OrderLog, 4), {"LogID", "Timestamp"}),
"AlertWindow",
each DateTime.IsInCurrentHour([Timestamp]) or DateTime.IsInNextHour([Timestamp]),
type logical
)LogID | Timestamp | AlertWindow | |
|---|---|---|---|
| 1 | L001 | 1/15/2024 9:30:00 AM | FALSE |
| 2 | L002 | 1/16/2024 2:15:00 PM | FALSE |
| 3 | L003 | 1/18/2024 11:00:00 AM | FALSE |
| 4 | L004 | 1/20/2024 8:45:00 AM | FALSE |