cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Total Hours

Seems like this should be an easy one. I have two dates [EventDate] and [EndDate] that I need subtracted for hours worked. These hours could go from 11pm  to 3am the next day. 

 

For reporting purposes in PowerApps charts and total month/year, I am looking for a final result as a number field. 

 

I can get the numbers I am looking for as a calculated field within a SharePoint list, but the calculated fields as a number format do not seem to work with the reporting I am trying to accomplish in with other calculations for reporting. 

 

My first step was to convert both start and end using this. formatdatetime(triggerBody()?[EventDate],'HH:mm')

With those results, I thought I could just use an expression to subtract the two with an output as a number format and not a text.

 

This link is great for SharePoint, but I am looking for a step further when using Flow and PowerApps. http://thuansoldier.net/?p=3823

 

So I think I just need a start date - end date = total as a number format. 

 

2 REPLIES 2
v-yamao-msft
Community Support
Community Support

Hi msmith,

 

Microsoft flow uses workflow definition language to work with parameters. But it seems that currently there is no function can be used to count hours between two days.


The doc on workflow definition language for your reference:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language


Please consider submitting a request at Flow ideas Forum at here, I will help collect and report it on my side:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
efialttes
Super User III
Super User III

@Anonymous

Have you tried translating the dates to be compared into ticks? The general procedure for comparing dates is described in the following thread:

https://powerusers.microsoft.com/t5/Building-Flows/Compare-dates/td-p/54802

 

Once you get the difference in ticks you shall convert it into hours. Given a timestamp in string format, the ticks() expression returns the number of ticks (100 nanosecond intervals) since 1st January, 1601. By using ticks, we can compare two different timestamp values.

 

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (54,683)