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
mattlancs
Advocate II
Advocate II

Taking current status from a table of dated changes

Hi all,

 

I'm trying to write a come up with a measure that'll tell me how many man hours are in the company on any given day. I've got my data in a table which lists any changes to their contracted hours, something like this:

 

PersonDateHours
Dan Aykroyd   01/01/2018   8
Dan Aykroyd01/04/20206.4
Dan Aykroyd05/10/20200
John Belushi01/09/20198
John Belushi01/04/20206.4

 

For clarity's sake: 8 hours per day equates to a five day working week, 6.4 hours is a four day working week, 0 hours is no longer working.

 

I've also got a separate simple date table. I think I'm looking for a measure that will sum up the hours column for each person when the date is as high as possible but still less than the date table's date. Ultimately I'd like to be able to plot a graph showing how the number of man-hours changes over time, or to be able to use this for seeing how many hours someone should have worked in a given year. Any hints will be gratefully received!

4 REPLIES 4
amitchandak
Super User
Super User

@mattlancs , what is the expected output.

Hi there,

I'm looking to have a measure to give the total contracted hours on any given day in my date table, basically. So I could then use that as an effective company headcount for any day, or to see how many hours should have worked in a date range.

@mattlancs , Check if these two measures can help

Total person days = countx(summarize(filter(table, table[Hours]>0), table[date], table[person]),[person])
Total hours = countx(summarize(filter(table, table[Hours]>0), table[date], table[person]),[Hours])

Hi there,

Thanks very much for those measures, the effort is much appreciated. Unfortunately they didn't help, as they were still including the outdated earlier entries in the table - I think that's my fault for not explaining the data structure properly. I've come up with a bit of a workaround now in Power Query to change the single date field into both a Start Date and an End Date column, then I can report on that based on the date table being between them. It'll need a bit more work to get the filtering tidy, but that's a job for next week.

Thanks again for your time.

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