4 Replies Latest reply on Mar 20, 2014 12:13 PM by Ivan Monnier

    Tracking previous YTD quantities

    john.taylor.0

      Greetings!

       

      I am a new user to Tableau, and I'm trying to calculate a % difference between Current YTD volume and Previous YTD volume.

       

      I can calculate current YTD easy enough, however I'm having difficulty arriving at the correct number for the Previous YTD figures.

       

      I'm trying to use a calculated field, and have used the following formula:

       

      IF

           DATEDIFF('year',[Order Date],TODAY())=1

      AND

           Month([Order Date])<=MONTH(TODAY())

      THEN

           [SALES]

      END

       

      This returns a result that is correct if calculating for the first two months of the year, but I don't want the remaining days of February to be calculated. I want a true Year to date.

       

      Can someone assist on how to write the proper formula to accomplish this?

       

      For example, I want all sales figures from 01/01/12 through the 02/04/12 (assuming today is 02/04/13.

       

      Any help is greatly appreciated.

       

      John