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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Compose due date to be...
Power Apps
Suggested Answer

Compose due date to be a weekday in Power Automate Flow

(2) ShareShare
ReportReport
Posted on by 4
In my Power Automate flow I want to take a due date from my SP list, 1) make it 3 days earlier, 2) make sure it's a weekday (Monday to Friday), 3) add the formatted date to an email.
 
I am able to get the 3-days-earlier date using compose function: addDays(body('Get_item')?['ResponseDue'], -3)
 
I am able to put that date into my email: formatDateTime(outputs('Compose_-_Date_Add_Days'), 'D')
 
I am really struggling with figuring out a formula to make sure the 3-days-earlier, falls on a weekday. 
 
1. To retrieve the number for the day of the week - compose action: dayOfWeek(outputs('Compose_-_Date_Add_Days'))
2. To determine if it's a weekday or weekend - condition: outputs from dayOfWeek, is equal to 6 or is equal to 0
3. If true: condition: outputs from dayOfWeek is equal to 6, is not equal to 6
4. If true (I will need to make the Saturday a Friday): compose: addDays(body('Get_item')?['ResponseDue'], -4)
5. If false (I will need to make the Sunday a Monday): compose: addDays(body('Get_item')?['ResponseDue'], -2)
 
I don't know how to move on from step 2 if the condition is false, will it automatically go to the next step in the flow? If not, how do I tell it to do that?
How can I put whatever date is produced from step 4 and 5, or the initial compose action for the 3-days-earlier date, into my email?
 
I feel like this is something a lot of businesses will come across (making sure the due date is a weekday) but I'm having great difficulty finding a straightforward solution.
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,969 Moderator on at
    Hi,
     
    Let's ignore the email for a moment.
     
    1. Create a Variable that will store the Date, that you finally want to use after you have verified its 1-5 day of week or 0,6
    Since this date will be the date you want to leverage in your code after.
     
    To find out what day it falls on, you use the dayOfWeek(date) expression. Which you have, but you should swap it so that the Yes part is Monday - Friday, not that the yes part is Saturday or Sunday
     
    Sunday = 0
    Saturday = 6
     
    So, if the answer is 1-5 then its in the day of the week so your condition would be
     
    Left side Expression above using your date 3 days back,
    middle = great than or eq to
    right side 1
     
    Add another expression to the condition and make it an And
     
    Expression above using your date 3 days back,
    middle = less than or eq to
    right side 5
     
    1a) In your Yes Side, it means it was 1-5. So use the Set Variable action to set the Variable you created at the top, so now you have your date to use going forward. In this case its exactly the date you created when you subtracted 3 days.
     
    So to now answer you as to how it moves on.
     
    1b) In the No Side (0 or 6) and you need to calculate how many days you need to "subtract from either 0 or 6, to make it Friday, which was your ask"
    Then you want to use THAT integer value to subtract more days from your already existing 3 day removed Date.
     
    So... you add a Compose
    in the compose you will like this
     
    if(equals(dayorweekvalue, 0, 2), 1)
     
    Now what this does is, if its Sunday (0) you need to subtract 2 MORE days from your 3 day already subtracted, or subtract 5 from the original date. If its not 0 then we know its 6 in which case its Saturday and we need to subtract 1 more day from your 3 day already subtracted, or subtract 4 from the original date
     
    After the compose use the Set Variable to set the date
    In the expression you need to do something like
     
    addDays(body('Get_item')?['ResponseDue'], -(3 + int(Outputs(YourCompose)));
     
    This way, it takes your original 3 days, adds the output of the previous step and THEN subtracts it.. And it will always be friday.
     
    now outside of the Condition, you continue on all happy because the Variable has your proper Date.
     
    and done.
     
     
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard