0 Replies Latest reply: Sep 26, 2016 9:24 AM by Conor O'Kane RSS

    Sum of last year sales to current calendar month

    Conor O'Kane

      Hi,

       

      I am looking to create a table, with product category as the dimension, that will include a column for the sum of all sales of each product in the previous year only including months up to the latest calendar month in the data for this year. So if the most recent date in the entire dataset is July 2016, then the column would sum sales for each product from January through to July 2015.

       

      My data looks like this:

       

      Posting DateCategoryTotal Value
      04/01/2015Storage730
      11/01/2016Training235
      .........

       

      And my LOAD script like:

       

      Spend:

      LOAD

      Month(Date([Posting Date])) as [Posting Month],

      Year(Date([Posting Date])) as [Posting Year],

      [Total Value],

      Category

      FROM <filepath...>

       

      I attach a data set that contains these data fields.

       

      Desired outcome is:

      CategorySum Sales in 2016Sum sales in same months in 2015
      Storage£X£A
      Training£Y£B
      .........

       

      Any help would be greatly appreciated