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 ?
Please refer the image below:
Any help would be appreciated !
Solved! Go to Solution.
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] ) ) )
I replicated your data and chose Average of Rating instead of Sum or Don't summarize etc..
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] ) ) )
User | Count |
---|---|
343 | |
156 | |
85 | |
78 | |
44 |
User | Count |
---|---|
404 | |
242 | |
112 | |
110 | |
97 |