Forum Discussion
ketan10
Advocate III
8 years agoNeed Help: Rolling Average (Last 2 days) | When multiple dates in a column
I have an original table using which I need to calculate the rolling average of rating table. However I do not get the expected output. Can somebody please help me with a DAX solution for this ? Pl...
- 8 years ago
Hi ketan10
Try this MEASURE
Rolling 2 Days Average = AVERAGEX ( TOPN ( 2, FILTER ( ALL ( TableName[Date] ), TableName[Date] <= SELECTEDVALUE ( TableName[Date] ) ), TableName[Date], DESC ), CALCULATE ( AVERAGE ( TableName[Rating] ) ) )
rabih
8 years agoFrequent Visitor
I replicated your data and chose Average of Rating instead of Sum or Don't summarize etc..
- Zubair_Muhammad8 years ago
Community Champion
Hi ketan10
Try this MEASURE
Rolling 2 Days Average = AVERAGEX ( TOPN ( 2, FILTER ( ALL ( TableName[Date] ), TableName[Date] <= SELECTEDVALUE ( TableName[Date] ) ), TableName[Date], DESC ), CALCULATE ( AVERAGE ( TableName[Rating] ) ) )- Zubair_Muhammad8 years ago
Community Champion