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!