web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Use expressions in flo...
Power Automate
Answered

Use expressions in flow actions to filter by Year and calculate hours between start and end time.

(0) ShareShare
ReportReport
Posted on by 257

Please I have SharePoint list synced with the office outlook 365 calendar using power automate flow as below.

I need to build expressions in the Filter Query to achieve these needs:

1- I have hours column in the list I need to add an expression to it in order to calculate the hours between start and end time in office outlook calendar.

2- I need to add expression to filter events synced with office outlook 365 to sync the only years 2020 and 2021.

 

 2021-04-05 09_49_44-Daily Operation Follow-UP Meeting _ Microsoft Teams.png

Categories:
I have the same question (0)
  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @gme-eg 

     

    For the filtration to get years 2020 and 2021 Please use below expression on ODATA Filter on the Filter Query Property of the Get Events

     

    start/DateTime ge '2020-01-01T00:00:00.0000000'
    

     

  • v-litu-msft Profile Picture
    on at

    Hi @gme-eg,

     

    To make a supplement.

    If you want to calculate hours between start and end date, you could use ticks() function to approach that, here is a post with the solution by xida, it could help you:

    Solved: how to get difference between two dates in flow - Power Platform Community (microsoft.com)

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @gme-eg 

    As mentioned by @v-litu-msft  the expression that you should use in your case is as below, Please add a compose data operation action before create Item and use the below Expression  and this will return the difference in minutes

    div(div(mul(sub(ticks(items('Apply_to_each')?['end']),ticks(items('Apply_to_each')?['start'])),100),1000000000),60)

    Mira_Ghaly_0-1617614327701.png

     

  • Ghada Mehrez Profile Picture
    257 on at

    @Mira_Ghaly I got error message :

    2021-04-05 11_50_39-Edit your flow _ Power Automate.png

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @gme-eg 

    Just add it on the filter Query directly without using the Expression pane.

    Mira_Ghaly_0-1617616445896.png

     

  • Ghada Mehrez Profile Picture
    257 on at

    Now I followed all steps and inserted the Filter Query directly with no errors but when I save the flow it gave me this error it seems related to apply to each step.

    2021-04-05 11_58_48-Daily Operation Follow-UP Meeting _ Microsoft Teams.png

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @gme-eg 

    Please move the compose data operation inside the apply to each loop

    Mira_Ghaly_0-1617616964039.png

     

  • Ghada Mehrez Profile Picture
    257 on at

    @Mira_Ghaly yes now it works the events of 2020 and 2021 only syncs but in terms of the Hours Column, it didn't calculate the hours between start and end time.

  • Mira Ghaly Profile Picture
    11,413 Moderator on at

    @gme-eg

    Can you open the flow history and check the output of the compose data operation

     

  • Ghada Mehrez Profile Picture
    257 on at

    2021-04-05 12_22_24-Daily Operation Follow-UP Meeting _ Microsoft Teams.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard