Forum Discussion

ketan10's avatar
ketan10
Icon for Advocate III rankAdvocate III
8 years ago
Solved

Need 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...
  • Zubair_Muhammad's avatar
    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] ) )
    )