Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric Ideas just got better! New features, better search, and direct team engagement. Learn more

Rolling average of previous 6 month month

Hello, 

I had a problem as follows:
I needed a rolling average of previous 6 month. Means I want the average of the 6 month before say July. Means that as of Jan till Jun I needed the average and this average should be showed in July.

It took 2 measures to achieve this:
1ste measure:

Moving average extra =

VAR Period =

 DATESINPERIOD('DateTable'[Date],

                MAX('DateTable'[Date]),

                -6,MONTH

"here is the time span you taking for the number of month you want"

Var Mon =

    CALCULATE(DISTINCTCOUNT('DateTable'[Month]),

    Period)

VAR Totinvoice =

    CALCULATE(SUM('FINDB_DMT FCT_INVC_LINE_DTLS_HIST'[INVOICED_TONNAGE]),

    Period)

VAR Aver6month =

    Divide(Totinvoice,Mon)

RETURN

   (Aver6month)


In the 2nd Measure I took care of the fact that the 6 month average was placed in July in stead of June.

Moving Aver Offset =

    CALCULATE([Moving average extra],

    PREVIOUSMONTH('DateTable'[Date]))


No difficult formula's just straight on and easy to do, it does work I compared the results with the figures I already had in excel done.



Status: New