2 Replies Latest reply: Mar 11, 2017 10:19 AM by Andy Weir RSS

    Bar Chart - Compare sales made this year to sales made last year but same day of the week

    annick whitfield

      Hello,

       

      I would like to compare the sales made this year with the sales made last year but with the same day of the week.

      Example: compare sales done on 01Feb2017 Wednesday with sales done on 03Feb2016 Wednesday.

       

      Here's my load script:

      mySales:
      LOAD * INLINE [ Country, SaleYear, SaleMonth, SaleDay, SaleDayOfWeek, SalesNb
      FR, 2016, Feb, 01, Mon, 12
      FR, 2016, Feb, 02, Tue, 15
      FR, 2016, Feb, 03, Wed, 13
      FR, 2016, Feb, 04, Thu, 15
      FR, 2016, Feb, 05, Fri, 10
      FR, 2016, Feb, 06, Sat, 0
      FR, 2016, Feb, 07, Sun, 0
      FR, 2017, Jan, 30, Mon, 10
      FR, 2017, Jan, 31, Tue, 12
      FR, 2017, Feb, 01, Wed, 14
      FR, 2017, Feb, 02, Thu, 17
      FR, 2017, Feb, 03, Fri, 12
      FR, 2017, Feb, 04, Sat, 0
      FR, 2017, Feb, 05, Sun, 0
      ES, 2016, Feb, 01, Mon, 8
      ES, 2016, Feb, 02, Tue, 5
      ES, 2016, Feb, 03, Wed, 3
      ES, 2016, Feb, 04, Thu, 5
      ES, 2016, Feb, 05, Fri, 2
      ES, 2016, Feb, 06, Sat, 0
      ES, 2016, Feb, 07, Sun, 0
      ES, 2017, Jan, 30, Mon, 7
      ES, 2017, Jan, 31, Tue, 9
      ES, 2017, Feb, 01, Wed, 7
      ES, 2017, Feb, 02, Thu, 10
      ES, 2017, Feb, 03, Fri, 11
      ES, 2017, Feb, 04, Sat, 0
      ES, 2017, Feb, 05, Sun, 0
      ];

       

      Here's my bar chart with :

      - Dimension: country

      - Measure : Sum({<SaleYear = {'2017'} >}SalesNb)

       

      Capture.PNG

      I would now like to add another measure with the sum of sales but for the sales made same dates minus 364 days (in order to compare Monday with Monday, Tuesday with Tuesday, etc...).

       

      Thanks a lot!

      Annick