Forum Discussion

michael_knight's avatar
michael_knight
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Previous 3 Months Average

Hi,

 

I'm trying to create a measure which will display the average of the last 3 months

 

 

This is what I want is have as a average over the last 3 months. For example, April's % will be an average of April, March and February. January's % will be January 2021, Demember 2020 and November 2020 etc

 

I tried searching on the forums and came accross this piece of code 

3 Month Rolling Average Fall Through = 
var threeos = CALCULATE (
    AVERAGEX ( VALUES ( 'Date'[Month/Year] ), [Confirmed]),
    DATESINPERIOD ( 'Date'[Full Date], MAX ( 'Date'[Full Date] ), -3, MONTH )
)

var threewith = 
CALCULATE (
    AVERAGEX ( VALUES ( 'Date'[Month/Year] ),[Fall Through]),
    DATESINPERIOD ( 'Date'[Full Date], MAX ( 'Date'[Full Date] ), -3, MONTH )
)

return

IFERROR(threewith/threeos, BLANK())

This results in what it looks the next 3 months rather than the previous so I don't think that's right. Here's a screenshot

 

I'm struggling which is why I came here

 

Here's the PBIX: https://www.dropbox.com/s/4pbc79tpo9yg59a/help.pbix?dl=0

 

Any questions let me know

 

Cheers,

Mike

  • Hi, michael_knight 

     

    Pleases try the below measure.

     

    3 Month Rolling Average Fall Through =
    IF (
    ISBLANK ( [Confirmed] ),
    BLANK (),
    CALCULATE (
    AVERAGEX ( VALUES ( 'Date'[Month/Year] ), [Fall Through %] ),
    DATESINPERIOD ( 'Date'[Full Date], LASTDATE ( 'Date'[Full Date] ), -3, MONTH )
    )
    )

     

     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

2 Replies

  • Hi, michael_knight 

     

    Pleases try the below measure.

     

    3 Month Rolling Average Fall Through =
    IF (
    ISBLANK ( [Confirmed] ),
    BLANK (),
    CALCULATE (
    AVERAGEX ( VALUES ( 'Date'[Month/Year] ), [Fall Through %] ),
    DATESINPERIOD ( 'Date'[Full Date], LASTDATE ( 'Date'[Full Date] ), -3, MONTH )
    )
    )

     

     

    Hi, My name is Jihwan Kim.

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.