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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Anonymous
Not applicable

Time diff from different rows based on name e day (Hours worked)

Hi there,

 

I have to build a dax measures to calculate the worked time of each employee. The challenge here is that the data is saved by a sequence of input that the employee saves his timesheet in the MS forms.

 

I have the table below:

fabnishi1207_1-1625237219862.png

And I need to build a dax formula for the following requirements:

 

By employee:

  • Hours worked today
  • Hours worked this week
  • Hours Worked from home

 

To achieve this I need the time diff from different rows, however, based on the employee name and the day.

 

Any way to achieve this easily in DAX without the need to change the structure of my table?

 

Thanks in advance.

 

Now the table to make easier the copy and paste

 

IDStart timeEnd TimeNamePlace of workStarting or finishing work?
17/1/21 8:107/1/21 13:01JohnHomeStarting
27/1/21 8:127/1/21 13:10AhbraHomeStarting
37/1/21 8:057/1/21 14:00ElisaHomeStarting
47/1/21 8:137/1/21 15:10ElisaHomeFinishing
57/1/21 8:007/1/21 16:00JohnHomeFinishing
67/1/21 8:457/1/21 13:00AbhraHomeFinishing
77/1/21 8:527/1/21 13:00JohnOfficeStarting
87/1/21 8:487/1/21 13:00ElisaHomeStarting
98/1/21 8:038/1/21 13:20JohnOfficeFinishing
108/1/21 8:468/1/21 13:03ElisaHomeFinishing

 

 

 

 

 

1 ACCEPTED SOLUTION
Portrek
Resolver III
Resolver III

Hello fabinishi1207

 

Try this measure below

 

TimeWork =

VAR DATEDIFF = DATEDIFF(MINX(Table,Table[Start time]),MAXX(Table,Table[End Time]),MINUTE)


return

DATEDIFF
 
 
Best Regards

View solution in original post

2 REPLIES 2
Portrek
Resolver III
Resolver III

Hello fabinishi1207

 

Try this measure below

 

TimeWork =

VAR DATEDIFF = DATEDIFF(MINX(Table,Table[Start time]),MAXX(Table,Table[End Time]),MINUTE)


return

DATEDIFF
 
 
Best Regards
Anonymous
Not applicable

Hi Portrek,

 

Thanks for the feedback but unfortunately it didn't work as expected.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.