Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 |
---|---|
101 | |
90 | |
80 | |
71 | |
69 |
User | Count |
---|---|
114 | |
98 | |
97 | |
73 | |
72 |