Forum Discussion
Moving Average Per Day
Hello everyone
I'm working on a daily average calculation in Power BI, but currently what I get is a sum of the values per day, rather than the average.
My goal is that, as the days progress, the values accumulate and divide them by the number of days elapsed, to obtain a moving average.
Can you tell me what adjustments I need to make to my formula or approach to achieve this?
Thank you in advance!
3 Replies
- Ritaf1983
Super User
Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
- Ashish_Mathur
Super User
Hi,
This measure pattern should work
Moving average = averagex(summarize(calculatetable(calendar,datesbetween(calendar[date],eomonth(min(calendar[date]),-1)+1,min(calendar[date]))),calendar[date],"A",[Total]),[A])
If this does not work, then share the download link of the PBI file. Show the problem and the expected result there.
- AnonymousNot applicable
Hi grgilardi,
Please try this measure:
Promedio Movil = VAR __DiasHastaHoy = MAX ( 'Date'[Date] ) VAR __values_accumulate = CALCULATE(SUM('Inventarios'[Faltantes]),'Date'[Date]<=__DiasHastaHoy) VAR __days = COUNTROWS(FILTER(ALL('Date'),'Date'[Date]<=__DiasHastaHoy)) RETURN DIVIDE(__values_accumulate,__days)Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum