Forum Discussion

Uzi2019's avatar
Uzi2019
Community Champion
3 years ago
Solved

Standard Deviation

Hi Expert, Could you please help me to compute STDEV of revenue in DAX? I am attaching below data along with how it's working in exce date source channel revenue Expected Output SD SD Formu...
  • v-jianboli-msft's avatar
    3 years ago

    Hi Uzi2019 ,

     

    Please try:

    First create an index column:

    Then apply the measure:

    Measure =
    VAR _a =
        STDEVX.S (
            FILTER (
                ALL ( 'Table' ),
                [Index] <= MAX ( 'Table'[Index] )
                    && [Index]
                        >= MAX ( 'Table'[Index] ) - 1
            ),
            [revenue]
        )
    VAR _b =
        MINX ( ALLEXCEPT ( 'Table', 'Table'[channel] ), [date] )
    RETURN
        IF ( MAX ( 'Table'[date] ) = _b, BLANK (), _a )
    

    Then show items with no data:

     

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.