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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.