cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Silva_BR
Helper III
Helper III

define the end of the week

Hi guys!
I would like to know how to define the end of the week, for example counting only from Monday to Friday, to count the working days in a report, if the inspection was carried out daily!
Ty!

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @Silva_BR,


The weekday function is useful for this. That will return a number for each day. Saturday is 7, Sunday is 1.

 

So in your example you only want weekdays from 2 to 6.

 

Below is an example of using that weekday function.

 

Weekday(StartDate.SelectedDate)

weekdayfunction.png

 

You could even calculate the workdays by using datediff and rounddown functions with that. In this Microsoft blog there is a description of that approach:

https://powerapps.microsoft.com/en-us/blog/excluding-weekends-and-holidays-in-date-differences-in-po...

 

RoundDown(DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) / 7, 0) * 5 +
Mod(5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate), 5)

 

calculateworkdays.png

View solution in original post

1 REPLY 1
Expiscornovus
Super User
Super User

Hi @Silva_BR,


The weekday function is useful for this. That will return a number for each day. Saturday is 7, Sunday is 1.

 

So in your example you only want weekdays from 2 to 6.

 

Below is an example of using that weekday function.

 

Weekday(StartDate.SelectedDate)

weekdayfunction.png

 

You could even calculate the workdays by using datediff and rounddown functions with that. In this Microsoft blog there is a description of that approach:

https://powerapps.microsoft.com/en-us/blog/excluding-weekends-and-holidays-in-date-differences-in-po...

 

RoundDown(DateDiff(StartDate.SelectedDate, EndDate.SelectedDate, Days) / 7, 0) * 5 +
Mod(5 + Weekday(EndDate.SelectedDate) - Weekday(StartDate.SelectedDate), 5)

 

calculateworkdays.png

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

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.

Users online (1,518)