Subtotal Earliest time and latest time difference

fever003

New Member
Joined
Aug 14, 2015
Messages
2
Hi,

I am trying to calculate the duration between the earliest and last timestamps in a day for each person.

Group Name Login Time Logout Time
1 Ben 2/5/2015 8:00 2/5/2015 9:00
1 Ben 2/5/2015 13:00 2/5/2015 18:00
2 Amy 2/5/2015 8:00 2/5/2015 18:00

Formulas

First Login:=MIN(table1[Login Time])
Last Logout:=MAX(table1[Logout Time])

Duration:=1*SUMX(table1,[Last Logout]-[First Login])

The results I am getting Ben in the pivot is

Group Name First Login Last Logout Duration
1 Ben 2/5/2015 8:00 2/5/2015 18:00 6:00:00
2 Amy 2/5/2015 8:00 2/5/2015 18:00 8:00:00
Grand Total 14:00:00

The results I am expecting is,

Group Name First Login Last Logout Duration
1 Ben 2/5/2015 8:00 2/5/2015 18:00 8:00:00
2 Amy 2/5/2015 8:00 2/5/2015 18:00 8:00:00
Grand Total 16:00:00

The concern now is the duration and grand total part.

Any help would be appreciated.

Thanks
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I'm super confused by Amy. 8 -> 18 sounds like 10hr duration... not 8!?

Anyway, I think the problem is that you are doing SUMX(table1, ...) which is looking at each row, 1 at a time. You want to look at 1 PERSON at a time...

Try... SUMX(values(table[Login]), ...)
 
Upvote 0
Ooops, im sorry. You are right, it should be 10 hours for Amy. Will give it a try, but will that formula you suggested give the duration?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,029
Messages
6,128,403
Members
449,448
Latest member
Andrew Slatter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top