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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Average of monthly percentage change

Hi,

 

I need the average of a monthly percentage change.

What I need to do is : SUM ([monthly %  change]) / DISTINCTCOUNT (calendar[year-month]) )

The issue I am facing is that I calculated the monthly percentage change with a measure. And I cannot SUM a measure.

 

I have following columns

shop_id   date   customers   
AAA   2020/11/1   5000   
AAA   2020/11/2   3000   
AAA   2020/12/1   4000   
AAA   2020/12/2   1000   

I calculated the following measures to get the monthly percentage change:

 

1. total = SUM(table[customers])

2. total_LM = CALCULATE([total], PREVIOUSMONTH(calendar[date]))

3.monthly % change = DIVIDE( [total], [total_LM]), BLANK())-1

 

shop_id   year-month   total   monthly % change  (measure) 
AAA   2020/ 11   8000   +20 %
AAA   2020/ 12   5000   -37.5 %    
AAA   2021/ 1   6000   +20 %   
AAA   2021/ 2   5000   -16.67 %    

 

I want to calculate SUM (monthly % change) / DISTINCTCOUNT (year-month) to get the average, so:

-14.17 / 4 = -3.54

 

Can anybody help me with this?

1 ACCEPTED SOLUTION

@Anonymous , Try like

averageX(values(Date[Month Year]),[monthly % change])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , how this giving 3, is not clear

 

you can have like calculate(DISTINCTCOUNT (calendar[year-month]), allselected(calendar))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak sorry , thanks for pointing this out. I edited the post.

I know how to calculate the monthly distinctcount,

 

but I don't know how to get the average of the monthly percentage change.

I thought I need to SUM all the monthly changes and divide by month.

@Anonymous , Try like

averageX(values(Date[Month Year]),[monthly % change])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak 

sorry, I tried your proposed measure again and I think it works.

 

average= AVERAGEX(VALUES('calendar'[year/month]),[monthly % change])
 
Thank you very much for your help!
Anonymous
Not applicable

@amitchandak 

thanks, I tried the measure you were proposing, but it doesn't give me the correct result.

 

I created a test pbx. file. Kindly see the link below.

https://1drv.ms/u/s!AsNOXcTG8UttgdoAYPJr9xfg1HBBsg?e=3fQNpZ

 

If you have any other idea, just tell me.  I am happy to try!

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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