Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago

Help with calculating 3 months rolling average

I have below Matrix which is 3 different measures (only below 2 are important)

 

"Cash Out ACT SAP" = Costs month by month

"Cash Out YTD SAP" = Accumulated costs based on first column

 

I want to calculate a forecast that goes into the empty cell/cells for column "Cash Out YTD SAP"

I want to make a forecast base on the last 3 months from "Cash Out ACT SAP"

So, in order to populate 12/1/2023 for "Cash Out ACT SAP" I will take average of (9/1 + 10/1 + 11/1)/3

I then want to PLUS than on "Cash Out YTD SAP" 11/1 to populate 12/1

 

Maybe new columns should be made.



Have tried below but returns an error:

Test =
VAR LastDate_ =
    LASTDATE ( 'Date'[Date] )
RETURN(CALCULATE(SUM( 'Date'[Month]), ([Cash Out ACT SAP]  + [Rolling Average 3 months])),
FILTER (
            ALL ('Date'),
            [Date] <= LastDate_
            && [Date] > DATEADD ( LastDate_, -3, MONTH )))

1 Reply