13 Replies Latest reply: May 4, 2018 5:03 AM by Semir Shewayish RSS

    Set Analysis: Last Year Same Week

    Semir Shewayish

      Hello

       

      Hope someone can help with this please.

       

      I have a table with week numbers and sales for those weeks. The weeks take the format yyww, e.g. 1831 means week 31 of year 2018.

       

      Within a Qlik Sense sheet I want to be able to show each week and the sales for that week as well as the sales for the same week in the previous year. E.g. an entry for 1831 might show

       

      WeekSales for WeekSales Last Year
      1831100.0095.00

       

      meaning sales in 1831 were 100.00 and in 1731 they were 95.00.

       

      This is just a sample of the data

       

      LOAD * INLINE [

      Week,Sales

      1731,95

      1732,97

      1733,99

      1831,100

      1832,101

      1833,102

      etc.

      ];

       

      So in a table the dimension would be Week and the Sales for Week would be sum(Sales).

       

      I'm not sure how to get the sales for the previous year. I want to be able to do something like

       

      sum({$<Week = {Week-100}>}Sales)

       

      But I know I can't do this.

       

      Can anyone think of a way to do this please?

       

      Thanks.