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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Higgs11
Frequent Visitor

counting number of employees by hours worked

I have a table that has employee hours by employee ID and Project. In the table the employee id will show up on multiple rows if they work on more than one project. I have a Dax to count the number of employees.

Total Headcount = DISTINCTCOUNT('Employee'[User ID])
I have a DAX for Total Hours
Total Hours = SUM('Employee'[Total Hours])
I have another measure for [Capacity Hours] which is the total hours in the month, for this example it will be 160.
I want to count the number of employees in buckets, for example:
A-Count the # of employees who worked less than 75% of the capacity hours  <= 0.75 *[Capacity Hours]
B-Count the # of employees who worked between 76% and 100% of capacity hours   >=0.75 * [Capacity Hours]
C-Count the # of employees who worked more than 100% of capacity hours  > [Capacity Hours]
 
The result will give me three rows in a table
Full/Part TimeTotal Headcount
A5
B9
C8

 

Example of 'Employee' table

User IDProjectTotal Hours
a1aa100
a1bb60
b1aa40
c1bb160
c1cc10
d1aa80
d1cc20

 

Thank you

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi, @Higgs11 

I am not sure if I understood your question correctly, but please check the below picture and the sample pbix file's link down below.

 

All measures are in the sample pbix file.

 

Picture1.png

 

 

Headcount by Group =
COUNTROWS (
FILTER (
VALUES ( Employees[User ID] ),
COUNTROWS (
FILTER (
'Group',
[Total hours Capacity] > 'Group'[Min]
&& [Total hours Capacity] <= 'Group'[Max]
)
) > 0
)
)
 
 
 

Hi, My name is Jihwan Kim.


If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Thank you for responding. I have three DAX Measures, one for Total Headcount, one for Total Hours, and one for capacity/budget hours. The main Employee table is large with Employee ID in multiple rows. I cannot count rows, I cannot "SUMMARIZETABE". I want to know how many employees are within 0-50%. 51%-75%, 76%-100%+ of the capacity/budgeted hours. Three DAX measures. 

I like the Group table, played around with it yesturday. Can I build a group table to compare Total Hours againg Capacity/Budgeted hours? Like 15 Employees worked 25% of the capacity/budgeted time? 

 

Thanks again 

Hi, @Higgs11 

Thank you for your feedback.

Sorry that I quite do not understand your question.

What do you mean by,  I cannot count rows, I cannot "SUMMARIZETABE" ?

Please share your sample pbix file's link, then I can try to look into it.

Thanks.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors