I am currently using this to get a year to date sales number. I have this snip working but I am trying to get the same info for last year.
SUM(CASE WHEN YEAR(OINV.DocDate) = YEAR(getdate()) THEN INV1.Quantity*INV1.Price END)AS YTD$
I would like to generate a LYTD$ field calculating the same info but year to date for the same time period last year. In this case it would be 1/1/14-6/2/14. I want this to be dynamic as is above.