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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
meierli
Helper I
Helper I

Calculate 3 Months Moving Average

I would like to calculat 3 months moving average,

 

The month in my Power Pivot are across and not down.

 

In the data model I have created a date table.

 

Any suggestions would be great.

 

UNFORTUNATLY I can't upload/downlad anything from my work PC.

 

 

 

meierli_0-1714502485514.png

meierli_1-1714502549673.png

 

 

 

5 REPLIES 5
meierli
Helper I
Helper I

Asmentioned in the beginning I dont use Power BI nor can I upload and download anything.

 

I figured it out yesterday.

Hi, @meierli 

Thank you very much for your reply. The above is a reference to the DAX expression for calculating the 3-month moving average. Have you solved the current problem? Can you share your solution so that others in the community can quickly find a solution if they encounter a similar problem? 

 

Best Regards

Jianpeng Li

meierli
Helper I
Helper I

Thanks for your reply, but I am not working with Power BI. I am working with Power Pivot in excel.

Hi, @meierli 

Thanks for your reply. You can achieve the effect of a 3-month moving average using the following DAX expression:

3 Month average = 
AVERAGEX(
    DATESINPERIOD(
        'Calender'[Date],
        MAX('Calender'[Date]),
        -3,
        MONTH
    ),
    [Sales amount]
)
    

Here are the results:

vjianpengmsft_0-1714619763120.png

The table on the left is the 3-month moving average that I replied to using the visualization in my previous reply, and the table on the right is the result of the DAX expression created above.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

v-jianpeng-msft
Community Support
Community Support

Hi, @meierli 

According to your description, if you want to create a 3-month moving average, you can follow the steps below, here I take sales amount as an example, I have the following two tables, the relationship is shown in the figure below:

vjianpengmsft_0-1714529826522.png

I created a sales amount metric using the following DAX expression, which I need to calculate the 3-month moving average.

Sales amount = SUM(financials[ Sales]) 

 I put the year, month, and sales amount metrics of the date table into the table is visual.

vjianpengmsft_1-1714530036057.png

Right-click on the table visual and create a visual calculation:

vjianpengmsft_2-1714530099538.png

Enter the following DAX expression:

average month line = MOVINGAVERAGE([Sales amount],3,FALSE)

 

vjianpengmsft_3-1714530204482.png

Here are the results:

vjianpengmsft_4-1714530270334.png

If you want to create this moving average on the line chart, this moving average is also a type step.

vjianpengmsft_5-1714530393766.png

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors
Top Kudoed Authors