Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
2 years ago
Solved

Calculated Column Subject to Context (Z-Score Calculation)

Hello I've been trying to create a calculated column to get the Z-Score of a piece of data segmented by a variable. I have managed to arrive at this formula (which I leave at the end), which ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Syndicate_Admin 

     

    "ALL" does not apply the slicer, you can try changing it to "ALLSELECTED". "ALLSELECTED" will retain the slicer filter and remove other filters.

     

    Please try the following:

     

    Create a measure.

    Measure = 
    var _Average = 
        CALCULATE(
            AVERAGE('Table'[Population]), 
            FILTER(
                ALLSELECTED('Table'),
                'Table'[Language spoken] in {[Language spoken]}
            )
        )
    var _DesvT = 
        CALCULATE(
            STDEV.S('Table'[Population]), 
            FILTER(
                ALLSELECTED('Table'), 
                'Table'[Language spoken] in {[Language spoken]}
            )
        )
    RETURN DIVIDE(SELECTEDVALUE('Table'[Population]) - _Average, _DesvT)

     

    Here is the result.

     

     

    Regards,

    Nono Chen

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