Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculate Standard deviation from a measure

Hello,    I appreciate that there are a few articles on here however,frustratingly I am yet to find one that solves my query.   Essentially I need to calculate the Standard deviation from a DAX m...
  • v-kkf-msft's avatar
    v-kkf-msft
    5 years ago

    Hi Anonymous ,

     

    Since you are using the iterator function STDEVX.P, you can refer to this post to understand the context in the iterator function.


    If you want to calculate the standard deviation for different periods and different stores, you can use the following formula.

     

    Measure = 
    IF(
        ISFILTERED('ssc_db_001 ga_incident_report'[Period]), 
        STDEVX.P( 
            VALUES('ssc_db_001 ga_incident_report'[Incident type]), 
            CALCULATE( COUNTA('ssc_db_001 ga_incident_report'[id]) ) 
        ),
        IF(
            ISFILTERED('ssc_db_001 ga_incident_report'[Store name]),
            STDEVX.P( 
                VALUES('ssc_db_001 ga_incident_report'[Period]), 
                CALCULATE( COUNTA('ssc_db_001 ga_incident_report'[id]) ) 
            ),
            STDEVX.P( 
                VALUES('ssc_db_001 ga_incident_report'[Store name]), 
                CALCULATE( COUNTA('ssc_db_001 ga_incident_report'[id]) )
            )
        )
    )

     

    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.