Forum Discussion

dapm11's avatar
dapm11
Frequent Visitor
3 years ago

AVEDEV Function equivalent in DAX?

Hello All,

 

I'm hoping some may be able to help, I'm looking to create a DAX measure that replicates the AVEDEV (excel function).  I want to find the AVEDEV of the "Fail Rate 2" measure with an average taken for the previous 180 days.

 

 

Thank you,

 

D

1 Reply

  • Try

    Ave dev =
    VAR Avg180Days =
        AVERAGEX (
            WINDOW (
                -179,
                REL,
                0,
                REL,
                ALL ( 'Date'[Date] ),
                ORDERBY ( 'Date'[Date], ASC )
            ),
            [Fail Rate 2]
        )
    VAR CurrentFailRate = [Fail Rate 2]
    VAR RESULT =
        ABS ( CurrentFailRate - Avg180Days )
    RETURN
        Result