Hi
I am currently creating a leave application with two scenarios
1. Working days for employee from Mon-Fri
2. Working days for employee from Mon-Sat
I have created 2 separated list for employee No 1 and 2, and the list have been working perfectly for the No 2. For No. 1 its still calculating saturday as working day so its still calculating the leave days as attached below where it should only be 1 day leave taken

But If I enter the date lets say from Fri-Sun, or Fri-Mon, the datediff working fine, only calculating Mon-Fri as the working day


I am 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
)
}
)
)
Any kind of help is really appreciated, thanks!