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

Trying to get Average of Change In a Value From One Month to the Next

I have the below matrix of invoices on hold for 2 months of data so far.

 

jjanecm_1-1634570659362.png

 

 

 

I have calcualated the "Delta" as the change from previous month.  There is no data for July so the result of the calculation for August is the same as the number of invoices.

 

In the total column, somehow my Dax is counting the nubmer of invoices instead of the number of invoices last month.  For exmple the first row of the matrix the total column for Delta under the heading "Avg Number" reads "10947" which is the sum of the number of invoices for Aug and Sept(4125+6822).

 

The Dax is below.  Why is this happening and how do I get my Dax to count the number of invoices last month for each month, in the total column?

 

jjanecm_2-1634570785728.png

 

Mark Janecek

PTP Metrics Analyst 
Johsn

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous,

 

Measures are calculated based on context so in this case when you go to the total value of your measure you are not making the average but in fact you are making the calculation of the total invoices - previous month total invoices are the two months and previous is 0 becuase there are no values.

 

In this case you need to add a AVERAGEX in order to achieve what you need should be something similar to:

 

AVERAGE = IF (HASONEVALUE(Table[Monthyear]), [Delta], AVERAGEX(VALUES(Table[Monthyear]), [Delta]))

 

Be aware that depending on your model this may need some adjustments


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @Anonymous,

 

Measures are calculated based on context so in this case when you go to the total value of your measure you are not making the average but in fact you are making the calculation of the total invoices - previous month total invoices are the two months and previous is 0 becuase there are no values.

 

In this case you need to add a AVERAGEX in order to achieve what you need should be something similar to:

 

AVERAGE = IF (HASONEVALUE(Table[Monthyear]), [Delta], AVERAGEX(VALUES(Table[Monthyear]), [Delta]))

 

Be aware that depending on your model this may need some adjustments


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

Thank You Miguel,  That worked great!

Hi @Anonymous 

 

Glad I could help don't forget to mark the correct answer so it can help other users.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.