cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
byronp
Frequent Visitor

Measure for Distinct Counts of days employees worked

Good Afternoon all, 

 

Please need help on solving this one !!!! 

 

I have a table iin_costs that has a list of all the hours employee's worked over a date range. They do a number of tasks throughout the day and there is more than three employees (but for the example i have just used three). 

iin_users.namereference dateHours worked Task
John Smith22/11/213.51
John Smith22/11/2112
John Smith22/11/2112

Rebecca Smith

22/11/2111
Rebecca Smith22/11/2123
Wayne Smith22/11/213.51
John Smith23/11/213.51
John Smith23/11/2112

Rebecca Smith

23/11/2111
John Smith24/11/213.51
John Smith24/11/2112

Rebecca Smith

24/11/2111
Rebecca Smith24/11/2123
Wayne Smith24/11/213.51
John Smith25/11/2112
John Smith26/11/2112
Rebecca Smith26/11/2123

 

 

What i would like is a measure so that i can display it on a card and to use for various other calculations that will display the number of employees that were working over any given date range (which will be a silcer) 

 

Eg. for the dates 22/11 through to 26/11  the number of employees that worked were 11 (John Worked 5 days, Rebecca Worked 4 days, Wayne worked 2 days)

 

I have tried this 

Measure = CALCULATE(DISTINCTCOUNT(iin_costs[reference_date]),  GROUPBY(iin_costsiin_costs[reference_date],iin_costs[iin_users.name]))
 
But that does not give me the count of the number of days John worked + the number of Days that Rebecca worked + the number of days Wayne worked. 
 
It just counts the distinct days that any person showed up for work which is 5. 
 
How do i get to count the number of days my distinct employees worked per employee then summed?
 
Cheers, 
Byron
1 ACCEPTED SOLUTION
byronp
Frequent Visitor
1 REPLY 1
byronp
Frequent Visitor

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Top Solution Authors
Top Kudoed Authors