7 Replies Latest reply: Nov 7, 2013 9:41 AM by Rajaram R RSS

    How can we get the sum of n rows from the actual table in Load?

      Hi All,

       

      I wan to calculate the sum of past 2 rows + current row  + sum of next 2 rows while loading itself.

       

      For eg,

      Actual Table:

      DateProduction
      01/10/201320
      02/10/201315
      03/10/201310
      04/10/201323
      05/10/201365
      06/10/20130
      07/10/20132

       

      Eg: Load Date, Production, ( Calculation = Past 2 values + current value + next 2 values) as Expected Result;

            SQL Select * from Actual Table;

      Expected Load data:

      DateProductionExpected Result = Past 2 values + current value + next 2 values
      01/10/20132020 + 15 + 1045
      02/10/20131520 + 15 + 10 + 23 = 68
      03/10/20131020 + 15 + 10 + 23 + 65 = 133
      04/10/20132315 + 10 + 23 + 65 + 0 = 113
      05/10/20136510 + 23 + 65 + 0 + 2 = 100
      06/10/2013023 + 65 + 0 + 2 = 90
      07/10/2013265 + 0 + 2 = 67

      Where  Green - Past values

                 Purple - Current Value

                 Blue - Next Values  and

                 Red - Final Result

      I hope this is enough to understand and give answer for my question.

       

      Please give your answers. I am awaiting your response.