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 / Leave Application for ...
Power Apps
Unanswered

Leave Application for different workdays arrangement

(0) ShareShare
ReportReport
Posted on by 50

Dear All,

 

Previously I have asked a similar questions https://powerusers.microsoft.com/t5/Building-Power-Apps/Incorrect-DateDiff-Calculation-in-Leave-Application/m-p/2717052

 

I am currently developing a leave app using for powerapps, now this app is already settled. The thing is, now I need to create a different working days calculation:

1. Working days Mon-Fri

2. Working days Mon-Sat

 

I have tried using sharepoint list to identify the user between category (1) and (2). and tried using this formula to calculate the datediff

 

If(LookUp(list1,Email_list1=User().Email,true),
UpdateContext(
 {
 daysdiff: RoundDown(
 DateDiff(
 StartDate.SelectedDate,
 EndDate.SelectedDate,
 TimeUnit.Days
 ) / 7,
 0
 ) * 5 + Mod(
 5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate),
 5
 ) - CountIf(
 '2024 ID Public Holiday',
 HolidayStart >= StartDate.SelectedDate,
 HolidayEnd <= EndDate.SelectedDate
 )
 }
),
UpdateContext(
 {
 daysdiff: RoundDown(
 DateDiff(
 StartDate.SelectedDate,
 EndDate.SelectedDate,
 TimeUnit.Days
 ) / 7,
 0
 ) * 6 + Mod(
 6 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate),
 6
 ) - CountIf(
 '2024 ID Public Holiday',
 HolidayStart >= StartDate.SelectedDate,
 HolidayEnd <= EndDate.SelectedDate
 )
 }
)
)

 

 

Now I have the issue where all user datediff is calculated as 6 working days, by any chance do I need to update my sharepoint list? Any kind of assistance is appreciated. Thankyou!

Categories:
  • mmbr1606 Profile Picture
    14,629 Super User 2026 Season 1 on at

    hey @safiranrd 

     

    can u try this please:

    If(
     LookUp(list1, Email_list1 = User().Email, true), // Checks if user works Mon-Fri
     UpdateContext({
     daysdiff: 
     RoundDown(DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) / 7, 0) * 5 +
     Mod(5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate), 5) -
     CountIf(
     '2024 ID Public Holiday',
     HolidayStart >= StartDate.SelectedDate && HolidayEnd <= EndDate.SelectedDate
     )
     }),
     UpdateContext({
     daysdiff: 
     RoundDown(DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) / 7, 0) * 6 +
     Mod(6 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedSelectedDate), 6) -
     CountIf(
     '2024 ID Public Holiday',
     HolidayStart >= StartDate.SelectedDate && HolidayEnd <= EndDate.SelectedDate
     )
     })
    )
    

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • safiranrd Profile Picture
    50 on at

    Hi @mmbr1606 

     

    Thank you for the advice, I tried using your formula but turns out the date is not calculating at all.. 

  • oyepanky Profile Picture
    567 on at

    Hi You can check this video

     

    Create Own Leave Management Application in PowerApps
    https://youtu.be/1FZU7-nCn7U

    IMG_7715.jpeg

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 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard