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

Running total of days in week per employee

I need to calculate a running total for days in a week per employee where it resets each week via a calculated column. Data is structured as so:

 

EmployeeID                       Hours                  Workdate             Weekend 

1                                        6                           1/1/21                  1/3/21

1                                        8                           1/2/21                   1/3/21

1                                        8                           1/4/21                   1/10/21

2                                        8                           1/2/21                   1/3/21

2                                        8                           1/4/21                   1/10/21

 

Where total for employees will be as follows:

Employee 1: Weekend 1/3/21 = 14, Weekend 1/10/21 = 8

Employee 2: Weekend 1/3/21 = 8, Weekend 1/10/21 = 8

 

This is ideally a calculated column so we can tell when an employee reaches 40 hours for the week and comparing it directly to it's workday

 

Thanks! 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@sparkplug93751 , Try like

 

if( sumx(filter(Table, [Weekend] = earlier([Weekend] ) && [EmployeeID] = earlier([EmployeeID])),[Hours]) >40 , true(), false())

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@sparkplug93751 , Try like

 

if( sumx(filter(Table, [Weekend] = earlier([Weekend] ) && [EmployeeID] = earlier([EmployeeID])),[Hours]) >40 , true(), false())

Hi, the Hours>40 needs to be the running total per day for the week ie days 1 through 3 = 35 

Working 10,10,15 hours each day then day 4 will get flagged if  you work 8 hitting the total of 43

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.