Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
tomperro
Helper V
Helper V

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 7
mh2587
Super User
Super User

Did you try this one 

CountTests = Count(EmployeeData[Tests])

✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn
mh2587
Super User
Super User

//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)


✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn

@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

 

 

CountTests = Count(EmployeeData[Tests])

 


✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn

@mh2587 

 

I have 2 tables with much more data than show below, just using these as examples.

 

Employee Data

Employee IDEmployee Name
1Employee1
2Employee2

 

Test Data

TestIDEmployee ID
A13 Employee1
B34 Employee1
C43 Employee1
A13 Employee2
D56Employee2
W43Employee3

 

I need to show counts

Employee1 did 3 tests

Employee2 did 1 test

Employee3 did 1 test

//Trythisone
Test Count = 
COUNTROWS(
    SUMMARIZE('Test Data', 'Test Data'[Employee ID], 'Test Data'[TestID])
)

✔ Answered? Mark as solution

Muhammad Hasnain | Super User • Fabric • Power BI • Data Engineering

Let's connect on LinkedIn

@mh2587 

Sorry for the back and forth, I wish there was a way to live chat.

 

That is giving me the count of test per employee, I need it to return the count of total tests.

 

Employee1 234 tests

Employee2 221 tests

Employee3 190 tests

Employee4 75 tests

 

I need the formula to return Total Tests = 720

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.