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 / Calculate date differe...
Power Apps
Answered

Calculate date difference on working days only?

(0) ShareShare
ReportReport
Posted on by 129

Hi, so I'm making an app to make leave request, I want to have a label show the amount of hours a person is requesting, the company allows to take partial days, so the person can take 1 to 8hs a day I have a date picker with 3 dropdows for start and end of time off that shows Date, Hour and minutes, what calculation can I make to show on a label the amount of hours a person is taking if they select for example, monday at noon to the next tuesday, so that would be a total of 44hs that they are taking

Categories:
I have the same question (0)
  • turnerj3 Profile Picture
    2,039 on at

    Here is a sample I found at the link below.

    This should get you started. You may need to change time units and will have to do some more manipulation to get those partial day hours.

    51BEF76B-20B9-4391-913E-E740E6C63C73.png


    https://devoworx.net/powerapps-business-days-between-two-dates/

     


    https://devoworx.net/powerapps-business-days-between-two-dates/

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

    Hi @FGRODRIGUEZ ,

     

    Please try:

    With(
     {
     startTime:DateTimeValue("2023-05-15 13:00:00"),
     endTime:DateTimeValue("2023-05-23 9:00:00")
     },
     Sum(
     ForAll(
     Sequence(DateDiff(startTime,endTime,TimeUnit.Hours),1,1),
     With(
     {temp: DateAdd(startTime,Value,TimeUnit.Hours)},
     If(Weekday(temp)=1||Weekday(temp)=7||Value(Text(temp,"HH"))<=9||Value(Text(temp,"HH"))>17,0,1)
     )
     ),Value)
    )

     

    Best Regards,
    Bof

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 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard