# How to create formula for YTD and YTG run rate (Moving average)  Hi

I would like to create formula to calculate moving average for YTD and YTG. Here's the formula i input MOVINGSUM(Actual, -11, 0, AVERAGE) to calcuate YTD run rate, MOVINGSUM(Remaining, -11, 0, AVERAGE) to calculate YTG run rate but the it doesn't seem correct to calculate the moving average.

Kindly see example from file attached.

thanks

Alice

Tagged:

•  In your formula you are hardcoding the numbers and taking the average of 11 months. I would say  make that dynamic and check how many periods are there in YTD actuals and how many are there in YTG actuals. (Also Use Actuals in both the line items - though I am not sure what the exact ask is). However you can still do below

Use that dynamic number in your formula

MOVINGSUM(Actual, -11, 0, AVERAGE)

MOVINGSUM(Remaining, -11, 0, AVERAGE)

Alternately I see you are already pulling the values by using SELECT YTD or SELECT YTG, if you do this way then you can just divide that number by the number of counts.

Hope that helps

Misbah

•  Sorry, Maybe my question confused you.

My financial year start from Jul19-Jun20.

YTD - Jul19-May20 (Already 11 period)

YTG-Left Jun20 (1 month to go).

Need your advice how to calculate the run rate base on YTD number of period, YTG number of period without hardcoding.

thanks

Alice

•  Step 1: Check thru formula how many periods are there in YTD Calcs like this

a) IF END() <= CURRENTPERIODEND() THEN 1 ELSE 0

b) IF END() > CURRENTPERIODEND() THEN 1 ELSE 0

Step 2: Count or Sum these numbers from Step 1a. In your case it should come to 11

Step 3: Count or Sum these numbers from Step 1b. In your case it should come to 1

Step 4: Use Line item from Step 2 in your YTD Formula instead of 11

Step 5: Use Line item from Step 3 in your YTG Formula instead of 1

The above process is only to show you how you can replace hard coded numbers with dynamic ones

•  why not using the YTD and YTG time items of Anaplan ?