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
Dunner2020
Post Prodigy
Post Prodigy

Problem with monthly average measure

Hi there,

 

Sorry for asking for a trivial issue. I have been stuck on the calculation for hours. I have got five years of monthly data. I want to calculate the cumulative sum of the average monthly data. For this purpose, I first calculate the measure that calculates the sum of the value for on the monthly basis:

 

sum_measure = sum(table[value])

As I have five years of data which means that each month has 5 values. So the next step is to calculate the Monthly average of the entire data set. So I created the monthly average measure using the following measure:

 

Monthly_average_measure = Averagex(values(Date['Month']),[sum_measure])

 

When I displayed the value and both measures in the table then it shows the following output:

myasir_0-1602636028290.png

As you can see that all three column produces the same value.

and If I include the year column in the table, it shows following output:

 

myasir_1-1602636213537.png

I was expecting that same RY Month Number column should have the same  Monthly average_measure value but that is not the case.

I am not sure where I made the mistake. Any help would be really appreciated.

 

 

 

 

1 ACCEPTED SOLUTION

@Dunner2020 , then you need to RY Month NO

 

Monthly_average_measure = calculate(Averagex(values(Date['Month']),[sum_measure]), allexcept(Date,Date[RY Month NO]))

 

better would be

 

Monthly_average_measure = calculate(Averagex(values(Date['Month']),[sum_measure]), filter(allselected(Date),Date[RY Month NO])=max(Date[RY Month NO]))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

7 REPLIES 7
amitchandak
Super User
Super User

@Dunner2020 , fi you take only yeat then if will give Monthly Average. Else use allexpect for year and try

 

Monthly_average_measure = calculate(Averagex(values(Date['Month']),[sum_measure]), allexcept(Date,Date[Year]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak , When I used your formula, it produces same monthly average as shown below:

 

myasir_0-1602639277500.png

I am expecting that same month should have same value. For example, the monthly average of April in 2016 should be the same as in April 2017 because its monthly average of 5 years.

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Dunner2020 , then you need to RY Month NO

 

Monthly_average_measure = calculate(Averagex(values(Date['Month']),[sum_measure]), allexcept(Date,Date[RY Month NO]))

 

better would be

 

Monthly_average_measure = calculate(Averagex(values(Date['Month']),[sum_measure]), filter(allselected(Date),Date[RY Month NO])=max(Date[RY Month NO]))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

will this work?

 

Monthly avg_measure 2 = IF(  SUM('5years'[Value]) , 
 CALCULATE(   AVERAGEX( VALUES(Dates[RY Month Number]),  SUM('5years'[Value]) ), ALLEXCEPT(Dates, Dates[RY Month Number])), blank())
Megha166
Microsoft Employee
Microsoft Employee

Can you share the excel spreadsheet with Data OR the list of coluns in base Table. I can write the measure on that Data.

Hi @Megha166 ,

 

Here is the link of pibx file https://1drv.ms/u/s!AucycxZHFe9TjS6G96JVtgslQLBX?e=1Njrdx 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors