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
Fitin1rb
Helper III
Helper III

Moving Average

Hello

 

I am trying to create a daily moving average.  I have no problem creating the moving average DAX calculation, but issue comes more in the detail. 

 

Here is the background.  I am trying to calculate a daily moving average based on the number of deals booked per day with this formula

Moving Average Booked Deals = IF(ISBLANK( [Total Booked Deals] ),
BLANK(),
AVERAGEX(
   DATESINPERIOD(
     Calendar[Date],
   LASTDATE(Calendar[Date] ),
   -'Moving Average What If'[MA Days], DAY ),
   [Total Booked Deals] ) )

 

Now the issue I have is that there are days that do not have deals booked (6/3/17 6/4/17 etc below) so the moving average is not taking those days into account......but I want them too.

 

 

booked.png

Is there a way to have the moving average include dates that have no data so that I can get a true moving average for the number of deals booked?

 

Thank You!!

Ryan

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Fitin1rb,

 

It seems that you may add zero to the formula.

[Total Booked Deals] + 0
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-chuncz-msft
Community Support
Community Support

@Fitin1rb,

 

It seems that you may add zero to the formula.

[Total Booked Deals] + 0
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft worked perfect, such a simple solution! Thanks for the advice!

Greg_Deckler
Super User
Super User

You will likely have to create a SUMMARIZE table and then calculate the AVERAGE off of that table. You could do this in a variable in your DAX formula for your measure.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thanks for the quick response, I am new to using Variables in my functions can you provide me with an example of what my variable would look like in this situation?

 

Thanks!

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.

Top Solution Authors