DateTimeZone.FixedLocalNow
DateTimeZoneReturns the current local date and time with UTC offset, fixed for the entire query evaluation.
Syntax
DateTimeZone.FixedLocalNow() as datetimezoneReturn Value
datetimezone — The local date, time, and UTC offset at which query evaluation began.
Remarks
DateTimeZone.FixedLocalNow returns the current local date and time including the UTC offset as a datetimezone value, fixed to the moment query evaluation began. Unlike DateTimeZone.LocalNow(), all calls to DateTimeZone.FixedLocalNow() within a single query will return the same timestamp, making it suitable for consistent time-based calculations.
Use this function when you need a stable, timezone-aware reference point across multiple computed columns or transformation steps in a single query.
Examples
Example 1: Calculate time since each event with a stable local timestamp
let
Now = DateTimeZone.FixedLocalNow(),
Source = Table.SelectColumns(Table.FirstN(Events, 4), {"EventID", "EventTime"}),
WithElapsed = Table.AddColumn(Source, "HoursSince",
each Duration.TotalHours(DateTimeZone.RemoveZone(Now) - [EventTime]),
type number)
in
WithElapsedThe final output — the WithElapsed table showing each event's elapsed hours since occurrence, computed from a single fixed local timestamp.
EventID | EventTime | HoursSince | |
|---|---|---|---|
| 1 | 1 | 1/15/2024 8:30:00 AM | 18,805.50 |
| 2 | 2 | 3/1/2024 2:00:00 PM | 17,694 |
Example 2: Return the fixed local now with timezone
#table(
type table [FixedLocalNow = datetimezone],
{{DateTimeZone.FixedLocalNow()}}
)FixedLocalNow | |
|---|---|
| 1 | 3/8/2026 4:00:00 PM |