DateTime.FixedLocalNow

DateTime

Returns the current local date and time, fixed for the entire query evaluation.

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

Syntax

Return Value

datetimeThe local date and time at which query evaluation began.

Remarks

DateTime.FixedLocalNow returns the current local date and time, but unlike DateTime.LocalNow(), it returns a consistent value for the entire duration of query evaluation. Multiple calls to DateTime.FixedLocalNow within a single query always return the same timestamp, making it suitable for calculations that require a stable reference point such as age calculations or elapsed-time computations across multiple columns.

DateTime.LocalNow() may return different values when called at different points during a long-running query, causing slight inconsistencies in computed columns that both reference "now". DateTime.FixedLocalNow() is guaranteed to be the same for every row in a transformation, eliminating this risk. Prefer it over DateTime.LocalNow() whenever you need a stable snapshot of the current time.

Note that in Power BI Service and Dataflows, the "local" time reflects the cloud region's system time (typically UTC) rather than your local machine's timezone. For cloud-hosted refreshes, consider using DateTimeZone.FixedUtcNow() instead for clarity and consistency.

Examples

Example 1: Calculate consistent elapsed time across multiple columns

let
    Now = DateTime.FixedLocalNow(),
    Source = Table.SelectColumns(
        Table.SelectRows(OrderLog, each [DurationMinutes] <> null),
        {"LogID", "Timestamp"}
    ),
    WithDays = Table.AddColumn(Source, "DaysOld",
        each Duration.TotalDays(Now - [Timestamp]), type number),
    WithHours = Table.AddColumn(WithDays, "HoursOld",
        each Duration.TotalHours(Now - [Timestamp]), type number)
in
    WithHours
Applied Steps

The final output — the WithHours table showing each log entry's age in both days and hours, computed from a single fixed timestamp.

LogID
Timestamp
DaysOld
HoursOld
1L0021/16/2024 2:15:00 PM781.9018,765.70
2L0041/20/2024 8:45:00 AM778.1018,675.20
3L0062/2/2024 10:05:00 AM765.8018,379.90

Example 2: Stamp rows with a consistent refresh timestamp

let
    RefreshTime = DateTime.FixedLocalNow(),
    Source = Table.SelectColumns(Table.FirstN(Sales, 4), {"OrderID", "OrderDate"})
in
    Table.AddColumn(Source, "AsOf", each RefreshTime, type datetime)
Applied Steps

The final output — adds an AsOf column to Source containing the fixed RefreshTime value on every row.

OrderID
OrderDate
AsOf
111/15/20243/8/2026 10:00:00 AM
221/18/20243/8/2026 10:00:00 AM
332/1/20243/8/2026 10:00:00 AM
442/10/20243/8/2026 10:00:00 AM

Example 3: Filter orders from the current day using a fixed reference

let
    Today = Date.From(DateTime.FixedLocalNow())
in
    Table.SelectRows(Sales, each [OrderDate] = Today)
Result
OrderID
CustomerName
Product
Category
UnitPrice
Quantity
OrderDate
Region

Compatibility

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