Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Calculate Hours Worked Per Week For Each Employee ID

I am very new to Power BI and cannot figure out the DAX to solve my problem. I have a table of data in Power BI that looks like the following table:

SiteEmployeeIDNameDateClocked PresenceWeek
ABC1234KatyM10/26/202310.51
ABC1234KatyM10/27/202311.421
ABC1234KatyM10/31/202391
ABC5567BruceK11/1/2023122
ABC5567BruceK11/2/202310.42
ABC9945AndyL10/26/202310.21
ABC9945AndyL11/7/202311.82
ABC9945AndyL11/9/202312.23

Anonymous321_0-1710870417968.png

 

 

I need to create a DAX formula that will sum up how many hours each employee worked for each week. So for example, I need to know the total number of hours EmployeeID 1234 worked in week 1, week 2, week 3 and so on. Same for the other employees. Once I have the total number of hours each employee worked each week, I will then use a dax formula to calculate how many overtime hours they worked over 40 for each week. No matter what I try, I can only get the total number of hours worked for all employees for all weeks, but not the hours an employee worked for a specific week. There are other columns in my data, but the table posted above is showing just the info I need. This seems like an easy DAX formula, but no matter how much googling I have done each solution I have tried does not work. Please help! Thank you. 

1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @Anonymous 

 

Would a measure like this help?

Total by Emp and Week = 
    CALCULATE(
        SUM( 'Table'[Clocked Presence] ),
        ALLEXCEPT( 'Table', 'Table'[EmployeeID], 'Table'[Week] )
    )

 

Let me know if you have any questions.

 

Total by Emp and Week.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

2 REPLIES 2
gmsamborn
Super User
Super User

Hi @Anonymous 

 

Would a measure like this help?

Total by Emp and Week = 
    CALCULATE(
        SUM( 'Table'[Clocked Presence] ),
        ALLEXCEPT( 'Table', 'Table'[EmployeeID], 'Table'[Week] )
    )

 

Let me know if you have any questions.

 

Total by Emp and Week.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
Anonymous
Not applicable

Awesome that worked like a charm, I accepted it as the solution. 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.