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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Sab
Helper V
Helper V

Calculater average for previous 12 months

Hello guys,

I need to calculate the avg of a column for the filtered values between the max date in the slicer (in this case 31 July 2024), going back 1 year (so from 1 Aug 2023), for the unique values in Deviation number column, with status CLOSED.

 

When I apply these filters in excel I get the values that you see in the excel status bar (52.25 for the average). When I write this formula in Power BI Desktop (created by an old friend of mine 😄 ), it gives 38.84, which is less that expected! We tried many times and different tweaks, but still can't match the result in excel

 

Sab_0-1730989307345.png

 

Here are both Power BI and excel files for you to check.

Data 

pbix file 

 

Thank you!

 

1 ACCEPTED SOLUTION
Selva-Salimi
Super User
Super User

Hi @Sab 

 

Although the measure had written so complicated but anyway, you should add an "all" before Deviation!

 

....filter (summarize (all(deviations) , ........

 

If this post helps, then I would appreciate a thumbs up 👍and mark it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
SachinNandanwar
Super User
Super User

Why do you have so many duplicates in the data ?

 

In the image below, I highlghted duplicates only for one month..There are hunderds of such duplicates.

SachinNandanwar_0-1730996175280.png

 



Regards,
Sachin
Check out my Blog

Because there are many other columns that prevent removing duplicates (for other calculations). thanks for taking time to look at it though!

Selva-Salimi
Super User
Super User

Hi @Sab 

 

Although the measure had written so complicated but anyway, you should add an "all" before Deviation!

 

....filter (summarize (all(deviations) , ........

 

If this post helps, then I would appreciate a thumbs up 👍and mark it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.