
Announcements
Hi folks,
First up, I am very much a layman when it comes to this and have had some success in learning as I stumble through Power Automate. I am very much in awe of the level of knowledge here and has already been useful!
I have created a recurring flow that will grab all of the events/meetings in my M365 Outlook calendar for the upcoming week and populate it into MS Lists and for most of the attributes I want to import, this works really well.
Where I am really struggling is calculating the duration of a given meeting, in hours, and reporting this as a number to 2 decimal places into my list into the budgeted hours field (in red below). I can already add in numbers when I manually add in new entries in the list.
I have become totally stuck on this so any help as to how I would go about this is appreciated.
Is it possible to include the "Start Time" and "End Time" fields from Outlook in the Dynamic Content area to be used in an expression and what's the general syntax for that? I have been trying to use div and sub expressions but having no joy at all!
Thanks in advance!
You can use the dateDifference() expression and then split out the hours or minutes from the string. OR You could also use a ticks() expression and formula.
I think the ticks() expression would work better for you, since you need a final number for billable hours.
Here is a reference. It looks long, but mainly because it is detailed. Scan through it and you should be able to see how to get what you want.
This will get the hours difference with decimal result.
div(sub(float(ticks({EndDateTime})),float(ticks({StartDateTime}))),36000000000)
Note: This is for full DateTime fields. It doesn't work for Time only fields.
If you have a Time only field, then you should put it together with the date to make a full DateTime field.