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 Apps / Calculating dates, ski...
Power Apps
Unanswered

Calculating dates, skipping weekends

(0) ShareShare
ReportReport
Posted on by 138

Hello,  
I'm looking for help regarding calculating dates and skipping weekends from the result.

The Scenario is the following:

Calendar for the start date, a numeric input for the days to add to the selected date in the start calendar and then the result to be shown in another calendar.

Thank you

Categories:
I have the same question (0)
  • RogierE Profile Picture
    875 Moderator on at

    Nice Challenge! To create a little mockup for your App, I created an App with two date-pickers and a slider to choose the number of workdays to advance. 

    RogierE_0-1710077310623.png

    In the OnChange of the slider I added this calculation for translating workdays to full week calculations:

     
    With({_WeekDayStart:Weekday(DatePicker1.SelectedDate),
        _AddWeekDays:Slider1.Value},
        Set(varAddDays,_AddWeekDays+2*RoundDown((_AddWeekDays+_WeekDayStart-2)/5,0)))
     
    So what this does is that every saturday it adds 2 days to get to the next workday. The tricky thing is that you have to calculate when Saturday occurs, depending on the weekday of your start day. As Monday counts as Weekday 2, adding _WeekdDayStart-2 will move the moment you add 2 days dependent on your start day. 
    Now varAddDays can be used to calculate the defaultselecteddate of the second Date Picker:
     
    DateAdd(DatePicker1.SelectedDate,Value(varAddDays),TimeUnit.Days)
     
    Please like the reply and/or accept it as the solution if the answer is what you were looking for.
  • Greg68 Profile Picture
    138 on at

    Thank you @RogierE  for your help, I appreciate it.

    I will try this solution and let you now, I tried many other ways, seems working but sometime the results are not accurate. So I need to keep searching for alternative solutions.

    Thanks

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard