Forum Discussion

hbgv123's avatar
hbgv123
Frequent Visitor
4 years ago
Solved

Rolling Months calculation error

Hi, I have recently started using powerBI. So I need your help to sort my issues. The  issue is in rolling average calculation where from raw data, i constructed a pivot.  My expected output is ba...
  • v-kkf-msft's avatar
    4 years ago

    Hi hbgv123 ,

     

    Please try the measure.

     

    Measure = 
    IF (
        MAX ( Sheet1[Month] ) <> BLANK (),
        CALCULATE (
            AVERAGEX (
                VALUES ( 'Calendar'[MonthYear] ),
                CALCULATE ( AVERAGE ( Sheet1[Risk Score] ) )
            ),
            DATESINPERIOD ( 'Calendar'[Date], MAX ( 'Calendar'[Date] ), -2, MONTH ),
            ALLSELECTED ( 'Calendar' )
        )
    )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.