4 Replies Latest reply: Oct 16, 2013 7:14 AM by Deviprasad Navik RSS

    ETL issue for average value

      Hi All,


      I am having a problem to calculate avg price, can anybody suggest some approach.



      I have a table contains 'billing date' , 'billing value' , 'Cust_ID' and 'billing qty'.

      I have to calculate each customer's Avg price.


      there is a logic to calculate avg price which Is like if I select a date from the table then from this selected date to last two month

      for eg if I select date 13-10-2013. then from this date to previous last two month (September & august) i.e 13-10-2013 to 01-08-2013.

      so for this particular date the avg price would be (total Billing Value from 13-10-2013 to 01-08-2013) / (Total Billing Qty from 13-10-2013 to 01-08-2013).


      Data is attached for reference.


      Thanks in advance to community