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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Write Expressio...
Power Automate
Unanswered

How to Write Expression for Get Calendars Based on the Day of the Week

(0) ShareShare
ReportReport
Posted on by 52

I am using the template, Email me with a list of upcoming Calendar events, connecting to an Outlook calendar. 

vlr516_0-1613673868468.png

 

I'd like the flow to trigger on weekdays to look at my calendar events for the next calendar date, with the exception on Friday to jump forward to Monday's calendar events. I do not know how to create the expression for the Friday email to look forward by additional hours than the flow does for all the other days. 

 

Here is what I have which I know works:

 

  1. Here is my setup of the trigger event.

image006.jpg

 

2. I set the PullStartTime variable to a dynamic expression:

convertTimeZone(startOfDay(addDays(utcNow(),1),'hh:mm tt dd MMM, yyyy'),variables('UserTimeZone'),'UTC')

 

3. Then I go get my calendar and I'm using the PullStartTime as my start time to get calendar view of events (v2) and end time is a dynamic expression:

addHours(variables('PullStartTime'),24)

thumbnail (3).jpeg

 

This works for the triggers on Monday through Thursday. Somehow I need to change the expression to be an if statement but I'm not sure exactly how to write it. Below is my thought for the End Time but I keep getting errors.

 

if(equals(dayOfWeek), 'Friday'), addHours(variables('PullStartTime'),48), addHours(variables('PullStartTime'),24))

 

Any help would be appreciated. 

 

Thanks. 

 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    v-yiwenxie-msft Profile Picture
    Microsoft Employee on at
    Re: How to Write Expression for Get Calendars Based on the Day of the Week

    Hi @vlr516 

     

    The expression you want to put in your 'End Time' is wrong, you can try this:

    if(equals(dayOfWeek(variables('PullStartTime')),5),addHours(variables('PullStartTime'),48),addHours(variables('PullStartTime'),24))
     

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

  • vlr516 Profile Picture
    52 on at
    Re: How to Write Expression for Get Calendars Based on the Day of the Week

    Thank you. That worked. 

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 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard