Forum Discussion
How to create a moving average total.
Hi,
I am looking to create a moving average totalt for the last month.
Can someone please help?
PowerBiGuy1234
- Anonymous5 years ago
Hi Anonymous ,
If you just want to get the value of the last month, I suggest you use PREVIOUSMONTH() like this:
PreviousMonth = CALCULATE(AVERAGE('Table'[Value]),PREVIOUSMONTH('Table'[Date]))Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- amitchandak
Super User
Anonymous , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Try if these type of measures can help
M1= avergageX(values('Date'[Month]), calculate(sum(Table[Value])))
Moving Avg = calculate([M1], filter(allselected('Date'), 'Date'[Date]< min('Date'[Date]))) //till last month
or
Moving Avg = calculate([M1], filter(allselected('Date'), 'Date'[Date]<= max('Date'[Date]))) //till this month
- AnonymousNot applicable
Hi Anonymous ,
If you just want to get the value of the last month, I suggest you use PREVIOUSMONTH() like this:
PreviousMonth = CALCULATE(AVERAGE('Table'[Value]),PREVIOUSMONTH('Table'[Date]))Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.