5 Replies Latest reply: May 24, 2017 9:01 AM by Muñoz Héctor RSS

    Year vs Previous Year in Simple Table

    Muñoz Héctor

      Hi experts,


      Let´s suposse we have a table in script like:

       

      SALES:

      LOAD * INLINE [

      Year, Sales

      2010, 100

      2011, 200

      2012, 300

      2013, 400

      2014, 500

      2015, 600

      2016, 700

      2017, 800

      ];

       

      We need to create a simple table like:

       

       

      YearSalesSales Prev Year
      36002800
      20101000
      2011200100
      2012300200
      2013400300
      2014500400
      2015600500
      2016700600
      2017800700

       

      , but we cannot use functions like Above() as the user can select any sequence of years, e.g. 2010+2015+2017 and we woul need a table like:

       

       

      YearSalesSales Prev Year
      15001200
      20101000
      2015600500
      2017800700

       

      Any idea about how to achieve this with set analysis?

       

      Thanks in advance!

      Héctor