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

View all the Fabric Data Days sessions on demand. View schedule

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors