Forum Discussion

tomperro's avatar
tomperro
Helper V
2 years ago

Z-Score in Table Matrix Visual

I am trying to show the Z-Score for each employee in a table matrix.
I am using slicers to filter for different zones employees are in.

 

I am not sure how to write the DAX for the following variables:

TotalTests

TotalEmployees

AverageTests

StddDev 

 

With my slicer = "Zone 1"

 

Employee1 did 234 tests

Employee2 did 221 tests

Employee3 did 190 tests

Employee4 did 75 tests

Total Tests = 720

Total Employees = 4

 

TotalTests = 720

TotalEmployees = 4

AverageTests = 180

StddDev  = STDEVX.P (  ?  )  * should equal 72.39
ZScore = DIVIDE ( TotalTests - TotalEmployees , StddDev )
 

 

Desired Table Matrix:

EmployeeTotalTestsAverageTestsStandard DeviationZ-Score  
Employee123418072.39.75  
Employee222118072.39.57  
Employee319018072.39.14  
Employee47518072.39-1.45  

 

7 Replies

  • //Replace table & Column with yours---This might help you
    Z-Score = 
    VAR TotalTests = SUM(EmployeeData[Tests])
    VAR TotalEmployees = COUNTROWS(FILTER(EmployeeData, [Zone] = SELECTEDVALUE('Slicer'[Zone])))
    VAR AverageTests = AVERAGE(EmployeeData[Tests])
    VAR StddDev = STDEV.P(FILTER(EmployeeData, [Zone] = SELECTEDVALUE('Slicer'[Zone]))[Tests])
    RETURN
        DIVIDE(TotalTests - TotalEmployees, StddDev)
    
    
    • tomperro's avatar
      tomperro
      Helper V

      mh2587 

       

      Thank you for the quick response.

      How do I get the count of tests?

      Employee 1 did 234 tests. Each test is recorded as a new row in my tests table.

      TestIdEmployee
      A13Employee 1
      B34Employee 1
      C43Employee 1

       

      • mh2587's avatar
        mh2587
        Super User

         

        CountTests = Count(EmployeeData[Tests])

         

  • Did you try this one 

    CountTests = Count(EmployeeData[Tests])