Skip to content

YTD

YTD(expr, dateCol) · Time intelligence

Accumulates expr from the start of the year through each date bucket (a window SUM partitioned by year). The operand must be additive — a linear combination of Sum/Count aggregates (measure references included; Avg is admitted via sum/count decomposition). Anything else fails with SQX015.

RevenueYTD := YTD([Revenue], Date.Date)
// Ratios: accumulate the parts, then divide
AOVYTD := Divide(YTD([Revenue]), YTD([Orders]))

YTD([AvgOrderValue]) is rejected — a running sum of per-bucket ratios is silently wrong.