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 / How to make Future Dat...
Power Apps
Answered

How to make Future Date field based upon user input date and a dropdown field (that excludes holidays and weekends)?

(0) ShareShare
ReportReport
Posted on by 21

Greetings,

I am trying to determine a "Due Date". Based upon a "Project Start Date" and the "Number of days" that type of project allows for it to be worked. I want to exclude weekends and holidays. 

I have used many videos and have tried various methods. The simplest being the one show below which will give me a date in the future but doesn't include weekends or holidays, so it falls short.

This is located in the Default function of a field named Due Date:

 

If(
 IsBlank(DataCardValue_FileD.SelectedDate) || IsBlank(DataCardValue_DatePMI.SelectedDate) || !IsBlank(DataCardValue_DateC.SelectedDate),
 "",
 DateAdd(DataCardValue_FileD,Value(DataCardValue_SelectNoD.Text),TimeUnit.Days
 )
)

 

I have attempted to modify it using the method in this video:
https://youtu.be/QVvhDe6puq0
So, I have added an OnStartup to the App as shown below:

 

 

ClearCollect(
 colHolidays,
 Filter(
 Holidays,
 Year(HolidayDate) = Year(Now())
 )
);
Clear(colDateRange);
ForAll(
 Sequence(730,1),
 Collect(
 colDateRange,
 {
 RowIndex: CountRows(colDateRange) + 1,
 Date: DateAdd(
 Today() - 365,
 Value
 )
 }
 )
);
RemoveIf(
 colDateRange,
 Weekday(Date) = 1 || Weekday(Date) = 7 || CountRows(
 Filter(
 colHolidays,
 HolidayDate >= Date,
 HolidayDate <= Date
 )
 ) > 0
);

 


 However, I do not know how to modify the top If statement to get the future date from the user input date. Is there anyway to do this since I have done all of the background work to get the dates and the holidays?

Any advice @WarrenBelz @BCBuizer @Ethan_R @mmollet 

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @MarceloTafoya ,

     

    Please try:

    With(
     {
     'Project Start Date':Date(2023,6,8),
     'Number of days':10
     },
     Last(FirstN(Filter(
     ForAll(
     Sequence('Number of days'*10,0,1),
     With(
     {dataTemp:DateAdd('Project Start Date',Value,TimeUnit.Days)},
     If(
     Weekday(dataTemp)<>7 && Weekday(dataTemp)<>1 && !IsBlank(Filter(Holidays,Text(HolidayDate,"yyyy-MM-dd")=Text(dataTemp,"yyyy-MM-dd"))) ,
     {'effective date':dataTemp}
     )
     )
     ),!IsBlank('effective date')),'Number of days')).'effective date'
    )

     

    Best Regards,
    Bof

  • MarceloTafoya Profile Picture
    21 on at

    It seems to not change on the fly but to wait till after the SharePoint list is updated when the Submit(Form) is clicked. "stopped working right.

  • MarceloTafoya Profile Picture
    21 on at

    @v-bofeng-msft 

    Is there a way to make it more dynamic? To respond to changes in the Project Start Date so users can see it before submitting it?  Moreover, for some reason when the app starts this thing either takes forever to load or it doesn't load at all. It worked initially, however, not really working now?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard