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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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]))

 

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]))

@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]))

 

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
Employee
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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