Showing results for 
Search instead for 
Did you mean: 
Helper V
Helper V

How to compute for total hours from timestamps inside Data Table

Hello PowerApps Team, 


I've checked posts here on how to compute for the  summary of timestamps but I cannot find a scenario with a Data Table. 

I put a data table in my app:




Is there a way on how I can get the total hours per day? (Start time up to End minus the breaks?)

Is this possible?


The punches comes from the clock that I put inside the app with this formula: 
Text(CurrentDateTime,"[$-en-US]dddd mm/dd/yyyy hh:mm:ss")


Thank You ,






If the first and last record are guaranteed to be the first and last timestamps, use First and Last to get the rows, then get the cells with just the timestamp, and finally use DateDiff to calculate it. See if this helps.

Hello @poweractivate ,


I tried a couple of ways and I'm still not getting it. Sorry. I'm not very good with this. 


I am getting an error: Invalid argument type Text. Expecting a DateTime value instead. 
The formula that I am trying is this: DateDiff(First(Stamp).TimeStamp, Last(Stamp).TimeStamp [, "[$-en-US] hh:mm:ss" ] ).

If I separate the time: 



And I use the formula: Last(Stamp2).Time-First(Stamp2).Time


I am getting a zero value.
Can you help me fix my formula please?


Thank You ,




You must convert the Text values returned from the Control to DateTime values before the DateDiff function can be used to calculate the difference.


So try something like this instead:






and also






Please also note, if the above does not work directly DateTimeValue, you may have to make sure it is the right format first and use more functions in different way. You can consult these following links for more help on the appropriate functions:


You may even have to go as far as to use the Split function not only on the string but also on the parts of the string too, reconstruct the string into one of the valid formats for DateTimeValue first  using Concatenate before finally using it with DateTimeValue and ultimately DateDiff to accomplish this goal.


Check if this helps.

Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,421)