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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
yogiceg
Regular Visitor

Power BI - Rolling average for every month

Hi Experts,

Kindly assist how to make rolling average in power BI for the below excel made data. Need to make visualization with rolling average. Advance thanks.

 

Year-MonthNumber of itemsSales valueAverage per monthRolling average
2024-01201809.009.00
2024-02292428.348.67
2024-03191648.638.66
2024-04292408.288.56
2024-05151147.68.37
2024-069626.898.12
2024-072434714.469.03
2024-0810878.78.99
2024-098556.888.75
2024-1014926.578.53
2024-115163.208.05
1 ACCEPTED SOLUTION
v-kongfanf-msft
Community Support
Community Support

Hi @yogiceg ,

 

You can try formula like below:

 

MEASURE =
AVERAGEX (
    FILTER (
        ALL ( 'SalesData' ),
        'SalesData'[Year-Month] <= MAX ( 'SalesData'[Year-Month] )
    ),
    [Average per month]
)

 

vkongfanfmsft_0-1731398749270.png

 

Best Regards,
Adamk Kong

 

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

View solution in original post

6 REPLIES 6
divyed
Resolver IV
Resolver IV

Hello @yogiceg ,

 

Here is the dax for you.

 

Rolling_Average =
CALCULATE(
    AVERAGE('Test'[Avg_per_Month]),
    FILTER(
        ALL(Test[Year-Month]),
        Test[Year-Month] <= MAX(Test[Year-Month])
    )
)
 
divyed_0-1731422877853.png

 

I hope it solves your query. Please mark this as solution if this helps .

 

Cheers

 

bhanu_gautam
Super User
Super User

@yogiceg , PFA PBIX file




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






v-kongfanf-msft
Community Support
Community Support

Hi @yogiceg ,

 

You can try formula like below:

 

MEASURE =
AVERAGEX (
    FILTER (
        ALL ( 'SalesData' ),
        'SalesData'[Year-Month] <= MAX ( 'SalesData'[Year-Month] )
    ),
    [Average per month]
)

 

vkongfanfmsft_0-1731398749270.png

 

Best Regards,
Adamk Kong

 

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

yogiceg
Regular Visitor

Thanks for the reply. but, i am not getting the actual results. 

bhanu_gautam
Super User
Super User

@yogiceg , Try using 

 

Rolling Average =
CALCULATE(
AVERAGE('Table'[Average per month]),
DATESINPERIOD(
'Table'[Year-Month],
LASTDATE('Table'[Year-Month]),
-12,
MONTH
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Poojara_D12
Solution Sage
Solution Sage

Hi @yogiceg 

To create a rolling average in Power BI based on your data, follow these steps:

DAX:

 

Rolling Average = 
AVERAGEX(
    DATESINPERIOD(
        'Table'[Year-Month],
        LASTDATE('Table'[Year-Month]),
        -3,
        MONTH
    ),
    'Table'[Average per month]
)

 

Replace 'Table' with the actual name of your table in Power BI.

  • DATESINPERIOD defines the date range for the rolling average (3 months).
  • LASTDATE picks the latest date in the period.
  • AVERAGEX calculates the average over the date range

You can adjust -3 to a different number of months (e.g., -6 for a 6-month rolling average).

  • Go to Report view.
  • Insert a Line Chart from the Visualizations pane.
  • Set up the fields for the chart:
    • Drag Year-Month to the Axis.
    • Drag the new Rolling Average measure to the Values.
    • Optionally, add Average per month to compare both the actual monthly average and the rolling average.
  • Format the Line Chart as needed (line color, thickness, etc.).
  • Adjust the Date axis for clarity (ensure it's in chronological order).

This setup will display a rolling average that updates as each month is added to your data.

 

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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