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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

Calculate Moving Average

Hi,

I have data which looks like:

SiteDateValueMoving Average
London01-01-20220.10.1
London28-01-20220.20.15
London01-02-20220.30.2
London01-03-20220.60.3
London01-04-20220.120.48
Bradford01-01-202211
Bradford25-01-202232
Bradford11-02-202211.6
Bradford01-03-202252.5
Bradford16-04-2022104

I want to calculate moving average of val column. I have included manual calculations in last column for your reference

2 ACCEPTED SOLUTIONS
FreemanZ
Super User
Super User

hi @Anonymous ,

 

you may try to add a calculated column like:

Column = 
AVERAGEX(
    FILTER(
        data,
        data[Site]=EARLIER(data[Site])
            &&data[Date]<=EARLIER(data[Date])
    ),
    data[Value]
)

 it worked like:

FreemanZ_0-1698217799545.png

View solution in original post

ThxAlot
Super User
Super User

Moving AVG = 
AVERAGEX(
    WINDOW(
        1, ABS,
        0, REL,
        DATA,
        ORDERBY( DATA[Date] ),
        DEFAULT,
        PARTITIONBY( DATA[Site] ),
        MATCHBY( DATA[Site], DATA[Date] )
    ),
    DATA[Value]
)

ThxAlot_0-1698226806525.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

Could you please tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please feel free to let me know.

 

Best regards,
Community Support Team_Binbin Yu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ThxAlot
Super User
Super User

Moving AVG = 
AVERAGEX(
    WINDOW(
        1, ABS,
        0, REL,
        DATA,
        ORDERBY( DATA[Date] ),
        DEFAULT,
        PARTITIONBY( DATA[Site] ),
        MATCHBY( DATA[Site], DATA[Date] )
    ),
    DATA[Value]
)

ThxAlot_0-1698226806525.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



FreemanZ
Super User
Super User

hi @Anonymous ,

 

you may try to add a calculated column like:

Column = 
AVERAGEX(
    FILTER(
        data,
        data[Site]=EARLIER(data[Site])
            &&data[Date]<=EARLIER(data[Date])
    ),
    data[Value]
)

 it worked like:

FreemanZ_0-1698217799545.png

VahidDM
Super User
Super User

Hey @Anonymous 

 

do want that as a new cal column or measure?

btw, check this link and watch Greg's video:
https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Urgent-assistance-Calculate-the-moving-average-of-a-measure/m-p/3061542

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

 

LinkedIn | Twitter | Blog | YouTube 

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

Top Solution Authors