Hi,

Suppose I have the following observations. I would like to calculate the sales average for each observation based on the weekly average value computed from the other channels. For example, for the first observation, this is channel 1 so I will compute the week sales average based on 10 (channel 2) + 6 (channel 3) from week 1 and divide by two. How can I write a code to do this for a larger dataset. Thanks.


Channel Sales Week Avg
1 3 1
1 9 2
2 10 1
2 2 2
3 6 1
3 15 2