Solved

Combine MOVINGAVERAGE and PREVIOUS functions for run rate planning

  • 1 February 2023
  • 1 reply
  • 264 views

Userlevel 2
Badge +4

I would like to write a formula where the intent is for the metric to calculate the average of the prior 3 months of the metric itself.

I envisioned the syntax being something like the following, though it says MOVINGAVERAGE doesn’t support recursive mode.

MOVINGAVERAGE(PREVIOUS(month),3)

I understand that I could use MOVINGAVERAGE without PREVIOUS if the object being averaged was a separate metric, but the use case I have requires the formula to reference metric itself.

 

Is there any solution or workaround for this?  

icon

Best answer by Matt D 6 February 2023, 15:41

View original

1 reply

Userlevel 3
Badge +4

Hi Justin,

One way to calculate a moving average based on the prior months of the metric you are in is to use multiple PREVIOUS() functions with the same formula.

For instance, if you wanted each month to be the average of the previous 12 months you could write:

(previous(Month, 1) + previous(Month, 2) + … + previous(Month, 11) + previous(Month, 12)) / 12

I appreciate it isn’t the most elegant formula, but it should do the trick!

Thanks,
Matt

Reply