cancel
Showing results for
Did you mean:
Helper II

## Leave Request - Days wrong

Hi There,

I have a query which i hope you guys might be able to help me with.

The leave request application seems to be calculating the days requested wrongly.

When an employee requests a single day off, the applications gives them two, however when they request more days, it calculates properly.

I have been trying to fix this but no luck.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User

Hi @Dovetail ,

As your screen shot shows, you selected 2 days, 21 September and 22 September (not only one). If you want to select only one day please use on "To" the same day as "From" selected.

5 REPLIES 5
Super User

Hi @Dovetail ,

What is the formula you are using to calculate the days?

Dual Super User

Hi @Dovetail ,

As your screen shot shows, you selected 2 days, 21 September and 22 September (not only one). If you want to select only one day please use on "To" the same day as "From" selected.

Helper V

It Seems you have selected for two days. thats why it has decreased 2 days

Helper II

Hi

This is the calculation used to determine the days requested.

If(LeaveStartDatePicker.SelectedDate <= LeaveEndDatePicker.SelectedDate,
Set(_inclusiveTotalDaysRequested, DateDiff(LeaveStartDatePicker.SelectedDate, LeaveEndDatePicker.SelectedDate, Days) + 1 );
Set(_numFullWeeks, RoundDown(_inclusiveTotalDaysRequested / 7, 0));
Set(_numFullDaysPartialWeek, _inclusiveTotalDaysRequested - _numFullWeeks * 7);
Concurrent(Set(_startWeekday, Weekday(LeaveStartDatePicker.SelectedDate)), Set(_endWeekday, Weekday(LeaveEndDatePicker.SelectedDate)));
//calculates the number of business days in the partial week left over after whole weeks are subtracted out of total days requested
If(_numFullDaysPartialWeek = 6,
If(_startWeekday <= 2, Set(_numPartialWeekdays, 5), Set(_numPartialWeekdays, 4)
),
_numFullDaysPartialWeek = 5,
If(_startWeekday = 2, Set(_numPartialWeekdays, 5), _startWeekday = 1 || _startWeekday = 3 || _startWeekday = 4, Set(_numPartialWeekdays, 4), Set(_numPartialWeekdays, 3)
),
_numFullDaysPartialWeek = 4,
If(_startWeekday = 2 || _startWeekday = 3, Set(_numPartialWeekdays, 4), _startWeekday = 1 || _startWeekday = 4, Set(_numPartialWeekdays, 3), Set(_numPartialWeekdays, 2)
),
_numFullDaysPartialWeek = 3,
If(_startWeekday = 6 || _startWeekday = 7, Set(_numPartialWeekdays, 1), _startWeekday = 1 || _startWeekday = 5, Set(_numPartialWeekdays, 2), Set(_numPartialWeekdays, 3)
),
_numFullDaysPartialWeek = 2,
If(_startWeekday = 7, Set(_numPartialWeekdays, 0), _startWeekday = 1 || _startWeekday = 6, Set(_numPartialWeekdays, 1), Set(_numPartialWeekdays, 2)),
_numFullDaysPartialWeek = 1,
If(_startWeekday = 1 || _startWeekday = 7, Set(_numPartialWeekdays, 0), Set(_numPartialWeekdays, 1)
),
_numFullDaysPartialWeek = 0, Set(_numPartialWeekdays, 0)
);
Set(_workDaysInRequest, _numFullWeeks * 5 + _numPartialWeekdays);
Set(_holidaysInRequest, CountIf(Holidays, StartDate >= LeaveStartDatePicker.SelectedDate, StartDate <= LeaveEndDatePicker.SelectedDate));
Set(_requestedDays, _workDaysInRequest - _holidaysInRequest)

);

Helper II

Hi @gabibalaban

Aaah - You're right.

but look at this:

I changed the 1 to a 0 and it calculates properly when requesting a single day.

The problem appears when requesting more days now.
But thank you for this. I will explain to the staff that they have to use on "To" the same day as "From" selected.

Announcements

#### Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

#### June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

#### Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

#### New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,324)