YearToDate(date [, yearoffset [, firstmonth [, todaydate]]])

YearToDate flags and YTD in Power BI

Qlik's YearToDate() flag is relative to the reload date. DAX TOTALYTD is relative to the dates in the filter context. Pick the one that matches what users expect, or rebuild the flag as a calculated column.

Partial / different approach DAX

Short answer: For "YTD up to the last date in the selection", use TOTALYTD([Sales], 'Date'[Date]). For Qlik's "YTD as of the last reload", add a flag column on the date table with TODAY(), which is evaluated at refresh, and filter on it.

What it does in Qlik

YearToDate(timestamp, ...) returns true (-1) if the date falls between 1 January (or firstmonth) and the last script execution, inclusive. yearoffset = -1 gives the same period last year. It is usually stored as a flag field in the script and used in set analysis.

Qlik example

Qlik script and chart
// script, in the master calendar
-YearToDate(Date)        AS IsYTD,
-YearToDate(Date, -1)    AS IsPYTD,
-YearToDate(Date, 0, 7)  AS IsFYTD     // fiscal year starting in July

// chart
Sum({<IsYTD={1}>} Sales)

Power BI equivalent

Time intelligence (relative to the filter context)

DAX
Sales YTD = TOTALYTD ( [Sales], 'Date'[Date] )
Sales PYTD = CALCULATE ( [Sales YTD], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Sales FYTD = TOTALYTD ( [Sales], 'Date'[Date], "6-30" )

Refresh-time flags (Qlik's behaviour)

Calculated columns are evaluated at refresh, so TODAY() here plays the role of Qlik's reload timestamp.

DAX
Is YTD =
'Date'[Date] >= DATE ( YEAR ( TODAY () ), 1, 1 ) && 'Date'[Date] <= TODAY ()

Is PYTD =
'Date'[Date] >= DATE ( YEAR ( TODAY () ) - 1, 1, 1 ) && 'Date'[Date] <= EDATE ( TODAY (), -12 )

Sales YTD (flag) = CALCULATE ( [Sales], 'Date'[Is YTD] = TRUE () )

Gotchas and behaviour differences

  • With the full current year selected, TOTALYTD runs to 31 December, so it equals the full year to date of data, not "to today". Future dates without sales don't add anything, but a PYTD comparison will include the whole of last year. Limit it to dates with data, or use the flag.
  • TODAY() in the Power BI service uses UTC. Qlik's default todaydate is also the reload time in UTC, so the two agree. Around midnight, both can differ from local time.
  • Time intelligence functions need a contiguous, marked date table.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.