1
votes

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.

1
Hi! Could you provide us with some sample in a table or shared pbix file?Andreas
Do you have a calendar table/dimension?Jon

1 Answers

0
votes

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