Forum Discussion
Rolling Last 3 Months Using Dates In Period
- 5 years ago
sfalk781
Your granularity of the FactInternetSales21 table is not at day level, there are multiple records per dates. You need to summarize. to get the correct averageMoving X Months Avg = CALCULATE( AVERAGEX( SUMMARIZE( FactInternetSales21, FactInternetSales21[Order Date], "Amount",SUM(FactInternetSales21[Sales Amount])), [Amount] ), DATESINPERIOD( FactInternetSales21[Order Date], LASTDATE(FactInternetSales21[Order Date]),-3,day) )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
Fowmy Thanks alot. I looked at the source data which is ficticious data that I was testing with and saw that you were right, there are multiple days of data. My visual was aggregating by total sales amount. As far as the variable "amount" goes, is it standard to use that in all summarize functions?
We use SUMMARIIZE column(s) to create a virtual table, it is optional to add an aggegation column along with it like I did with a variable AMOUNT. You can use any name for it.
please refer support documents for further understanding
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂