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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
michaeldonnelly
Frequent Visitor

Rolling/Moving Average - Sports form guide

HI all, im looking to create a rolling average of the last 6 matches played by a team, so in the data below, what are the average points per game from the last 6, obviously this would be different per team. I can do this in tableau without much fuss, seems to be difficult in power BI, I can share the file if needed, i basically want to show this information on a line graph to help me spot trends

 

 

Team NameDatePoints
Aberdeen04/08/20193
Aberdeen11/08/20190
Aberdeen24/08/20191
Aberdeen31/08/20193
Aberdeen14/09/20191
Aberdeen21/09/20193
Aberdeen28/09/20190
Aberdeen05/10/20191
Aberdeen19/10/20193
Aberdeen27/10/20190
Aberdeen30/10/20193
Aberdeen02/11/20193
Aberdeen09/11/20193
Aberdeen24/11/20191
Aberdeen30/11/20193
Aberdeen04/12/20191
Aberdeen07/12/20190
Aberdeen14/12/20193
Aberdeen21/12/20190
Aberdeen26/12/20193
Aberdeen29/12/20191
Accrington03/08/20190
Accrington17/08/20191
Accrington20/08/20190
Accrington24/08/20190
Accrington31/08/20193
Accrington07/09/20191
Accrington14/09/20190
Accrington17/09/20191
Accrington21/09/20191
Accrington28/09/20193
Accrington05/10/20191
Accrington12/10/20190
Accrington20/10/20193
Accrington23/10/20190
Accrington26/10/20190
Accrington02/11/20191
Accrington16/11/20190
Accrington23/11/20193
Accrington07/12/20191
Accrington14/12/20193
Accrington21/12/20191
Accrington26/12/20193
Accrington29/12/20193

 

 

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @michaeldonnelly ,

 

try this.

Rolling AVG Points last 6 matches =
CALCULATE (
    AVERAGE ( 'Table'[Points] ),
    TOPN (
        6,
        FILTER ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] <= MAX ( 'Table'[Date] ) ),
        'Table'[Date], DESC
    )
)

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

6 REPLIES 6
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @michaeldonnelly ,

 

try this.

Rolling AVG Points last 6 matches = 
CALCULATE (
    AVERAGE ( 'Table'[Points] );
    TOPN (
        6;
        FILTER ( ALL ( 'Table'[Date] ); 'Table'[Date] <= MAX ( 'Table'[Date] ) );
        'Table'[Date]; DESC
    )
)

 

You may download my PBIX file from here.
Hope this helps.

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


On your file it seems to work perfectly, when I have copied the measure as the table names are all the same, I am getting a different result, which is baffling, I have attached my file

 

Link 

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @michaeldonnelly ,

 

I don't have access to your link.
Please check the authorization.
It should be "Anyone with this link".

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Doesnt seem to want to allow me the option to share without and email from my one drive, so uploaded to dropbox, link below

 

Try this one 

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @michaeldonnelly ,

 

try this.

Rolling AVG Points last 6 matches =
CALCULATE (
    AVERAGE ( 'Table'[Points] ),
    TOPN (
        6,
        FILTER ( ALLSELECTED ( 'Table'[Date] ), 'Table'[Date] <= MAX ( 'Table'[Date] ) ),
        'Table'[Date], DESC
    )
)

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


az38
Community Champion
Community Champion

hi @michaeldonnelly 

you could create a measure like this if I undersyant correct "rolling average"

Measure = 
calculate(average(Table1[Points]);TOPN(6;filter(ALL(Table1);Table1[Date]<=SELECTEDVALUE(Table1[Date]) && Table1[Team Name]=selectedvalue('Table1'[Team Name]));Table1[Date];DESC))

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.