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
thisguy
Advocate I
Advocate I

total hours worked in last year

I have an employee dataset just under 2000 rows that includes the following fields: 

 

EMP Numstart dateEnd dateExpected Hours
#11/01/202130/06/202138
#21/03/2021 25
#31/01/2019 40

 

i want to calculate the total expected hours in the last year for the full workforce and am having difficulty working out how to do this.  I'm not sure if i Should try and do this as a measure or calculated column.

 

I come from an excel background so i would normally step out in columns like so:  

 

HrsPerDay = Expected Hours / 5

StartCalcDate = Max of start date and date 1 year ago. 

EndCalcDate = Min of End date and today (or today if blank)

Eligibledays = networkdays between StartCalcDate & EndCalcDate 

workhours = Eligibledays * HPD

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@thisguy , refer this HR blog in current employee use per day hours and sum it for total hour

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

example

Total Hour = CALCULATE(Sumx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date]))),(Employee[hour per day ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@thisguy , refer this HR blog in current employee use per day hours and sum it for total hour

 

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

 

example

Total Hour = CALCULATE(Sumx(FILTER(Employee,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Employee[End Date]) || Employee[End Date]>max('Date'[Date]))),(Employee[hour per day ])),CROSSFILTER(Employee[Start Date],'Date'[Date],None))

thanks, exactly what i was after 🙂

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.