Average calculation using TI process
Posted: Fri May 31, 2024 4:13 am
Hi all,
Just looking for some advice on the best way to write a TI that is calculating historical averages based on a range of periods, then inserting that calculated value to a specified future month.
Here are some more details:
I have 2 parameters in my TI process ( pAvgYrStart and pAvgYrEnd).
These values can be any range of years but for this example we’ll use 2021 to 2023.
I also have 2 parameters which define the forecast start and end period ( pFcstStartPeriod and pFcstEndPeriod). This is to tell the TI which periods to paste the values against. For this example we’ll use Jan-2024 to Dec-2024.
The average calculation is quite simple in that if the user inserts a range of 3 years as in the example above, the process needs to look back at the 3 previous January months, sum them together and divide by 3. Then insert this value into Jan-2024. And the same goes for all periods in the Forecast start to end range.
I am able to calculate the denominator of this equation whether then users inputs 3 years or 10 years by just subtracting the pAvgYrEnd from pAvgYrStart but I’m running into a mental block with the numerator part of this equation.
Where I’m getting stuck is accumulating the values in the numerator and then inserting them to the corresponding future period. Jan-2021 + Jan-2022 + Jan-2023 / 3 should be placed into Jan-2024 and so on for all the rest of the periods.
Any advice or thoughts on how to approach this would be greatly appreciated.
Thanks in advance!
Just looking for some advice on the best way to write a TI that is calculating historical averages based on a range of periods, then inserting that calculated value to a specified future month.
Here are some more details:
I have 2 parameters in my TI process ( pAvgYrStart and pAvgYrEnd).
These values can be any range of years but for this example we’ll use 2021 to 2023.
I also have 2 parameters which define the forecast start and end period ( pFcstStartPeriod and pFcstEndPeriod). This is to tell the TI which periods to paste the values against. For this example we’ll use Jan-2024 to Dec-2024.
The average calculation is quite simple in that if the user inserts a range of 3 years as in the example above, the process needs to look back at the 3 previous January months, sum them together and divide by 3. Then insert this value into Jan-2024. And the same goes for all periods in the Forecast start to end range.
I am able to calculate the denominator of this equation whether then users inputs 3 years or 10 years by just subtracting the pAvgYrEnd from pAvgYrStart but I’m running into a mental block with the numerator part of this equation.
Where I’m getting stuck is accumulating the values in the numerator and then inserting them to the corresponding future period. Jan-2021 + Jan-2022 + Jan-2023 / 3 should be placed into Jan-2024 and so on for all the rest of the periods.
Any advice or thoughts on how to approach this would be greatly appreciated.
Thanks in advance!