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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
WorkHard_
Frequent Visitor

Calculate # of employees per task when an employee is assigned multiple times per task

What would be the correct way to calculate this following scenario:

TaskEmployee
1Employee1
1Employee2
1Employee2
1Employee3
1Employee4
1Employee5
2Employee1
2Employee2
2Employee3
2Employee 4

 

Notice, one employee is assigned twice which is normal in this dataset.
Using this measure formula I get:

 

 

 

 

 

#ofemployees_per_task = CALCULATE(DISTINCTCOUNT(Table1[EmployeeID])/DISTINCTCOUNT(Table1[ProjectID]))

 

 

 

 

 

Which is correct.

Task# of Employees
15
24

 

However, when looking at the total, this is not correct:

# of tasks # of employees
25


Instead, the desired result is:

# of tasks # of employees
29

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

2 REPLIES 2
Ahmedx
Super User
Super User

pls try this

Screenshot_4.png

Ashish_Mathur
Super User
Super User

Hi,

I am very confused about what you want.  Anyways, if you want to add the number of employees for both tasks, then try these measures:

Employee count = distinctcount(Table1[EmployeeID])

Measure = SUMX(VALUES(Table1[Task]),[Employee count])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.