Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Rolling Average on a Percent Value

Hi everyone, I am having trouble trying to calculate a rolling average of a percent measure.   I have a Calendar Table that is connected to a Transactions Table. The Transactions Table is made o...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

    I recreated a calendar table, and connected to Transactions table.

     

     

     

    Savings rate 12 months rolling avg: = 
    VAR _currentmonth =
        EOMONTH ( MAX ( 'Calendar'[Date] ), 0 )
    VAR _elevenmonthsago =
        EOMONTH ( MAX ( 'Calendar'[Date] ), -12 ) + 1
    RETURN
        AVERAGEX (
            SUMMARIZE (
                FILTER (
                    ALL ( 'Calendar' ),
                    'Calendar'[Date] >= _elevenmonthsago
                        && 'Calendar'[Date] <= _currentmonth
                ),
                'Calendar'[Month-Year],
                'Calendar'[Month-Year sort]
            ),
            [Savings Rate]
        )