7 Replies Latest reply: Aug 4, 2016 6:32 AM by Daniel Ansell RSS

    YTD this year, comparing THE SAME PERIOD previous YTD

    Paula Calva Villegas

      Hi Qlikers!

      I have 2 fields: OrderDate -> 01/01/2016 and Sales.

       

      To calculate Current YTD im using this measure: =SUM({$<OrderDate = {'>=$(=YearStart(Today()))<=$(=MonthEnd(Today()))'}>}Sales) and it works well.

       

      To calculate Previous YTD im using: SUM({$<OrderDate = {'>=$(=AddMonths( YearStart (Today()),-12))<=$(=AddMonths( MonthEnd (Today()),-12))'}>}Sales) and it works well too!

       

      But now i want to calculate the same period of the previous year. Example:

       

      Im calculating YTD: Sales from 01/01/2016 to 27/07/2016

      I want to calculate from previous YTD: Sales from 01/01/2015 to 27/07/2015..

       

      Anyone have any idea?

       

      Thanks a lot!!