Thursday 10 September 2015

YTD Formula

Option 1:

if
datediff('year', [Order Date], [date]) =0  and
month([Order Date]) <= month([date]) and
date( [Order Date]) <= date([date]) then [Sales] 
end

Here date is the parameter

Option 2:

if [Order Date] <= [date]

and DATEPART('year',DATEADD('month',12,[Order Date])) = DATEPART('year',DATEADD('month',12,[date]))
then [Sales]
end


Option 3: 

sum(if year([Order Date]) = year([dateinput]) and [Order Date] <= [date] then [Sales] END)