Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Rolling Average Using Index (NOT DATE)

Dear all, I would like to ask , "What are examples of workable coding that I can try using if I need to perform rolling average of 30 weeks using the INDEX row and NOT Dates?" because based on my re...
  • Greg_Deckler's avatar
    3 years ago

    Anonymous So like:

    Better RA = 
        VAR __Index = MAX('Table'[Index])
        VAR __MinIndex = __Index - 30
        VAR __Table = FILTER(ALLSELECTED('Table'),[Index] < __Index && [Index] >= __MinIndex)
    RETURN
        AVERAGEX(__Table,[Value])

    Note, I pretty much just replaced [Date] with [Index]...

    Better Running Total - Microsoft Power BI Community