cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
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.

Dovetail_0-1600244759674.png

Dovetail_1-1600244814281.png

 

Thanks

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Solution Supplier
Solution Supplier

Re: Leave Request - Days wrong

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.

 

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Leave Request - Days wrong

Hi @Dovetail ,

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

Highlighted
Solution Supplier
Solution Supplier

Re: Leave Request - Days wrong

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.

 

View solution in original post

Highlighted
Helper I
Helper I

Re: Leave Request - Days wrong

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

Highlighted
Helper II
Helper II

Re: Leave Request - Days wrong

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)

 

);

 

Highlighted
Helper II
Helper II

Re: Leave Request - Days wrong

Hi @gabibalaban 

 

Aaah - You're right.

but look at this:

Dovetail_0-1600247357258.png

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

Dovetail_1-1600247425873.png

Dovetail_2-1600247481817.png

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.

 

 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,332)