cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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
Highlighted
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.
Highlighted
Dual Super User III
Dual Super User III

@msmith

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Users online (11,946)