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
Anonymous
Not applicable

Missing dates for 4days Moving Average

Hi I am trying to find the moving average for a data sets with missing data but I am having hard time getting an accurate averages.

I did create a date table on the power query side and merge it with my data but for some odd reasons the average is not including the missing dates.

learn2fly_2-1626339775750.png

 

This is what Power Bi is showing:

 

learn2fly_0-1626338064067.png

 

 

But when I did it in Excel, I got the correct moving 4 days average:

learn2fly_1-1626338629945.png

Please any assist or help is greatly appreciated.Thank You!

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

Rolling 4 = CALCULATE(AverageX(values('Date'[Date]),[Revenue]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,Day))

View solution in original post

2 REPLIES 2
V-pazhen-msft
Community Support
Community Support

@Anonymous 

It work if you revenue is a column in the same table. I guess the problem is your [revenue] is a measure calculated based on the relationship between the tables. If you can just share the sample pbix, we should able to detect the issue. 

 

Paul Zheng _ Community Support Team

amitchandak
Super User
Super User

@Anonymous , Try like

Rolling 4 = CALCULATE(AverageX(values('Date'[Date]),[Revenue]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-4,Day))

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.