Hello,
I am working on an app that will forecast the due date of the task.
I have a number field that calculates the number of Days required to finish the task based on complexity. Now, I want the total number of days to be added from Start Date.
StartDate + DaysofCompletion = Deadline.
My problem is that it does not exclude weekend. And note that the DaysofCompletion is atleast 20 Days (which is close to 3 weeks = 3 weekends (Sat & Sun))
I wanted to exclude every weekend it will pass from Startdate + DaysofCompletion.
Kindly help me on this.
Thank you!
Solved! Go to Solution.
Hi @anabananei ,
Please try with this:
DateAdd(
DatePicker1.SelectedDate,
DaysofCompletion.Text + 2 * If(
(Weekday(
DatePicker1.SelectedDate,
Monday
) + Value(DaysofCompletion.Text)) > 7,
RoundDown(
(DaysofCompletion.Text - (5-Weekday(
DatePicker1.SelectedDate,
Monday
))) / 5,
0
) + 1
)
)
This code works in both cases
1. StartDate + DaysofCompletion is still in the same week
2. StartDate + DaysofCompletion is not in the same week
Hope this helps.
Sik
Please look at my post - it had this also. I did not think I had to re-paste it as it was all set out in the document for you.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @anabananei ,
Here is a good solution also excluding Public Holidays.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @anabananei ,
Please try with this:
DateAdd(
DatePicker1.SelectedDate,
DaysofCompletion.Text + 2 * If(
(Weekday(
DatePicker1.SelectedDate,
Monday
) + Value(DaysofCompletion.Text)) > 7,
RoundDown(
(DaysofCompletion.Text - (5-Weekday(
DatePicker1.SelectedDate,
Monday
))) / 5,
0
) + 1
)
)
This code works in both cases
1. StartDate + DaysofCompletion is still in the same week
2. StartDate + DaysofCompletion is not in the same week
Hope this helps.
Sik
Worked like a charm! Thank you!
Hi @v-siky-msft ,
Just a question, if I am to have a list of holidays from my country, how should I proceed with the solution?
Thanks,
A
Please look at my post - it had this also. I did not think I had to re-paste it as it was all set out in the document for you.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
I'll take a look. Thank you! 🙂
Hello @WarrenBelz ,
Thank you for your post. Upon review, the solution has identified both start date and end date. Whereas in my current solution, the app forecast exclude the weekends/holidays before forecasting the end date. What @v-siky-msft said works for me, however, I'm confused how to incorporate the holiday list from the formula. Any help would be appreciated.
Thank you!
User | Count |
---|---|
196 | |
124 | |
87 | |
49 | |
42 |
User | Count |
---|---|
284 | |
163 | |
138 | |
75 | |
72 |