Date.IsInYearToDate

Date

Returns true if the date falls between January 1 of the current year and today (inclusive).

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

Syntax

Date.IsInYearToDate(dateTime as any) as logical

Parameters

NameTypeRequiredDescription
dateTimeanyYesA date, datetime, or datetimezone value to test.

Return Value

logicaltrue if the date falls from January 1 of the current year through today, false otherwise.

Remarks

Date.IsInYearToDate returns true if the input date falls between January 1 of the current year and today's date (inclusive), as determined by DateTime.LocalNow(). This differs from Date.IsInCurrentYear, which includes the entire year including future dates. Use this function for YTD metrics where you only want to compare the portion of the year that has elapsed.

This is a critical distinction for YTD vs. full-year comparisons. Date.IsInCurrentYear would include all of April through December even in March, while Date.IsInYearToDate stops at today. Always prefer Date.IsInYearToDate when computing KPIs against a YTD target.

The function is re-evaluated on each query refresh. In cloud environments (Power BI Service, Dataflows), "today" is determined by the server's UTC clock, which may cause YTD to cut off at a different point than your local time. For timezone-accurate YTD calculations, compute the boundary explicitly using DateTimeZone.LocalNow() and compare dates directly.

Examples

Example 1: Filter year-to-date sales

Table.SelectRows(
    Sales,
    each Date.IsInYearToDate([OrderDate])
)
Result
OrderID
OrderDate
1381/10/2026
2402/20/2026
3423/8/2026

Example 2: Compare YTD vs. full current year flags

Table.AddColumn(
    Table.AddColumn(
        Sales,
        "IsCurrentYear", each Date.IsInCurrentYear([OrderDate]), type logical
    ),
    "IsYTD", each Date.IsInYearToDate([OrderDate]), type logical
)
Result
OrderID
OrderDate
IsCurrentYear
IsYTD
1381/10/2026TRUETRUE
2423/8/2026TRUETRUE
3456/15/2026TRUEFALSE

Example 3: YTD total revenue

let
    YTDSales = Table.SelectRows(Sales, each Date.IsInYearToDate([OrderDate])),
    TotalRevenue = List.Sum(
        Table.AddColumn(YTDSales, "Revenue", each [UnitPrice] * [Quantity], type number)[Revenue]
    )
in
    #table(type table [Metric = text, Value = number], {{"YTD Revenue", TotalRevenue}})
Applied Steps

The final output — a single-row table labeling the YTD revenue total.

Metric
Value
1YTD Revenue100

Compatibility

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