I have data in which a row haa number of week and the corresponding sales on this week. Now for each week i want to calculate the average sales of last 8 weeks using DAX formula.
Asked
Active
Viewed 3,002 times
1
-
Hi! Could you provide us with some sample in a table or shared pbix file? – Andreas Sep 27 '19 at 04:16
-
Do you have a calendar table/dimension? – Jon Sep 27 '19 at 19:52
1 Answers
0
a solution posted here makes use of DATESINPERIOD() and LASTDATE():
Moving_Average_3_Months = CALCULATE ( AVERAGEX ( 'Session', 'Session'[Sessions] ), DATESINPERIOD ( 'Session'[FullDate], LASTDATE ( 'Session'[FullDate] ), -3, MONTH ) )
I hope this helps

Valery Pavlov
- 56
- 5