0 Replies Latest reply: Jan 12, 2015 11:45 AM by priya veera RSS

    How to Compare one week data of one field with different weeks data of another field

      Hi All,


      I need to compare my inventory data of one week with different weeks data of sales. For example we have the data as shown below



      INVENTORY                                                                                          SALES                                                       Days of INV

      week 0(INV)                                        week1(sales)    week2(sales)    week3(sales)     week4(sales)..................               (DOI)


      1000                                                  200                    150                    500                300                                                  17.5



      so now I need to get DAYS OF INVENTORY, so for that I need to subtract sales from inventory like


      if sales  < inventory-------> 1000-200=800 (and this is for a week so I get 5 days of inventory)

                                              800-150(week2 sales)= 650 (and now we have 2 weeks So 10 days of inventory )

                                              650-500(week3 sales)= 150( and now we have 3 weeks So  15 days of inventory)

      now we have inventory < sales then--------> 150/300(week 4 sales)= 0.5(for a week, So we Multiply that with 5)=0.5*5=2.5

      (INVENTORY/SALES)                                        (So now we have total of 17.5 DAYS OF INVENTORY).


      So I need code to get this calculation, can anyone help me with this.