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 / Due Date and Time Calc...
Power Apps
Unanswered

Due Date and Time Calculation excluding weekends and Holidays

(0) ShareShare
ReportReport
Posted on by 26

Hey Guys,

 

I need assistance calculating the due date and time. My scenario is as follows. 

I have developed a Help desk system in power apps and would like to find the due date for each ticket created. My SLA is in hours. For example, a ticket with High priority has got an SLA of 4 hours.  Our working time is between 8 am to 5 pm and we work Monday to Friday. 

 

Thanks

Categories:
I have the same question (0)
  • MVP-Phipps Profile Picture
    3,508 Super User 2024 Season 1 on at

    I would use a Switch Statement to cover High, Medium, and Low priority. Then have a read of this article to help understand how to exclude wekends: https://powerapps.microsoft.com/de-at/blog/excluding-weekends-and-holidays-in-date-differences-in-powerapps/

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful as can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter: https://twitter.com/phipps0218

  • Emma Etigu Profile Picture
    26 on at

    Hi @phipps0218 ,

    Thanks for your feedback. The solution you have suggested works best if I have a start date and an end date. What I am looking for is a scenario where I can use a DateAdd function to calculate the Due date and time on the ticket creation page. 

     

    Thanks

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @eetigu ,

     

    I've made a test for your reference:

     

    I assume:

    • StartDateTime is DateTimeValue("2022-7-20T10:00:00")
    • There is a Holiday List  ["2022-07-20","2022-07-21"]
    • "High" SLA 4 Hours
    •  "Mid" SLA 8 Hours
    •  "Low" SLA 16 Hours

    The formula should be

    With(
     {StartDateTime:DateTimeValue("2022-7-20T10:00:00"),Priority:"High",HolidayList:["2022-07-20","2022-07-21"]},
     Last(FirstN(
     Sort(
     Filter(
     ForAll(
     Sequence(300),
     With(
     {TheEndDateTime:DateAdd(StartDateTime,Value,Hours)},
     {
     EndDateTime:TheEndDateTime,
     Count:If(
     Weekday(TheEndDateTime) in [2,3,4,5,6] &&
     Hour(TheEndDateTime) >=8 &&
     Hour(TheEndDateTime) <=17 &&
     !(Text(TheEndDateTime,"yyyy-mm-dd") in HolidayList),1,0)
     }
     )
     ),
     Count=1),
     EndDateTime,Ascending),
     Switch(Priority,"High",4+1,"Mid",8+1,"Low",16+1))).EndDateTime
    )

     

    Best Regards,

    Bof

  • Emma Etigu Profile Picture
    26 on at

    @v-bofeng-msft , 

     

    The solution you provided worked. 

     

    Thanks a lot 

  • legolass Profile Picture
    2 on at

    Hi  @eetigu 

    I know it has been a long time since you post, hope you see it. May i ask where did you write this formula in apps? I have been dealing with a similar issue, but i did not get how did you use this formula in apps.

     

    With best regards

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard