Hello everyone,
I am analyzing a sample of many firms with data recorded over a period of 30 years. I have data related to Total Assets (End of Period), but in order to go on with my analysis I need (for every firm in every year) the Average Total Assets between current year and previous year.
For example, let's say I have three firms (X, Y and Z) with data related to total assets for three years (20X1, 20X2, 20X3). I'm looking for a single function that compute the average total assets between 20X1 and 20X2 for firm X, the average total assets between the same years for firm Y, the average total assets between 20X2 and 20X3 for firm X, and so on.
Thanks for the attention.

Daniel