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
kelvin-lkhca
Helper I
Helper I

Dax Formula for the Moving Average Number of latest period selected

Dear All Experts,

 

I have created a moving average for the Book to Bill ratio as below illustrate. I also want to create a measure which pick the moving average of the latest period selected based on the date slicer. This measure should pick the MA of 2024-Jun, which is 1.53 because the date selected in below is Jun 2022 to Jun 2024. Can you please advise what is the Dax formula to retrieve the MA value of the latest period based on the date range selected in the slicer?

 

 

kelvinlkhca_0-1697102873766.png

 

1 ACCEPTED SOLUTION

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1697498815421.png

 


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

View solution in original post

11 REPLIES 11
Ashish_Mathur
Super User
Super User

Hi,

Drag this measure to a card visual

Measure = calculate([MovingAverage(BooktoBill)],datesbetween(calendar[date],eomonth(max(calendar[date]),-1)+1,eomonth(max(calendar[date]),0)))


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

Don't do this 😂.  It's not correct.

 

First, provide a sample of data as @lbendlin requested.  That will help tremendously...he helped me with something last week.  And thank you!

Second, there are some really powerful windows functions that will probably get you to where you want to be.  Just need some clarification on what the end goal is.

lbendlin
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Hi @lbendlin 

 

Thank you for your suggestion. I actually would like to attached the original PBI file but there is no attachment function when I post. I remembered that there was attach function when I posted quite sometimes back. May I know where I can attached the file when I post/reply?

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Hi @lbendlin 

 

I shared the file with the link below. Please let me know if you can access?

 

https://drive.google.com/file/d/1lCnvWV3T5tBsmUn5WkfqVH_lvDNZ7OH9/view?usp=sharing

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1697498815421.png

 


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

Awesome! Thanks a lot...

You are welcome.


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

Your formula seems to produce the right result?

 

lbendlin_0-1697464681056.png

says 1.53 for June 2024.

How Do I create a Dax formula which show the moving average of the latest month based on the range of the period selected. The latest month in the date range selected from example above is June 2024 and the moving average is 1.53. However, when I drag the Dax measure Movingaverage(Booktobill) to a card, it shows the MA of total 2.56 instead of 1.53.

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!

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.