I have a set of data with three columns; Customer, TimePeriod, and Quantity. TimePeriod is in the format of yyyymm. I'm trying to determine a formula to calculate a "rolling average" over the last 3 time periods, across all customers.
For example, In my row labeled 201704, I want a formula to return the average Quantity for all records from 201703, 201702, and 201701. The TimePeriod can occur multiple times in the data (by Customer), which makes it a little more complicated.
Any suggestions?