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
slounsbury
Helper II
Helper II

Grouping hours by time period and memberID

I'm trying to create a report for our HR team to automate our payroll system but am having trouble with a column grouping pay periods.

 

Here is what the table currently looks like:

MemberIDHours_LoggedTimesheet_Period
781302020-03-01 to 2020-03-07
781102020-03-08 to 2020-03-15
781262020-03-01 to 2020-03-07
781142020-03-08 to 2020-03-15

 

Here is the outcome I am looking for:

MemberIDHours_LoggedTimesheet_PeriodWeekTotal
781302020-03-01 to 2020-03-0740
781262020-03-08 to 2020-03-1536
781102020-03-01 to 2020-03-0740
781102020-03-08 to 2020-03-1536

 

I've been working on this report for a while and have hit a road block with this part I also need this column to be included in some of my other calculations for Overtime, PTO, ect. Any help is appreicated. Thanks! 

1 ACCEPTED SOLUTION
cmilligan262
Helper II
Helper II

@slounsbury 

Try:

Week Total = Calculate(Sum('Table'[Hours_Logged]),Filter('Table','Table'[Timesheet_Period]=EARLIER('Table'[Timesheet_Period])&&'Table'[Member ID]=EARLIER('Table'[Member ID])))

View solution in original post

3 REPLIES 3
cmilligan262
Helper II
Helper II

@slounsbury 

Try:

Week Total = Calculate(Sum('Table'[Hours_Logged]),Filter('Table','Table'[Timesheet_Period]=EARLIER('Table'[Timesheet_Period])&&'Table'[Member ID]=EARLIER('Table'[Member ID])))

@cmilligan262 Thank you! This worked exactly as expected. After adding this I realized I need to have only one value per timesheet period. Would it be possible to have it appear like the tablet below? There is also a date column in this table (Last_Updated) that is available if it can be done based on which entry is first, if that makes sense?

 

MemberIDHours_LoggedTimesheet_PeriodWeekTotal
781302020-03-01 to 2020-03-0740
781262020-03-08 to 2020-03-1536
781102020-03-01 to 2020-03-070
781102020-03-08 to 2020-03-150

@slounsbury 

 

Not sure if I can get it to show 0's like you want but try creating a summarized table so it just shows the week total.

 

Create a new table with the formula

Summarized Table = SUMMARIZE('Table','Table'[MemberID],'Table'[Timesheet_Period],"Week Total",Sum('Table'[Hours_Logged]))

 

Depending on the output you want and what you're trying to create this may be better done as a measure.

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.