cancel
Showing results for
Did you mean:
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
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)``

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)``````

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)``

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)``````

Announcements

#### Power Platform Community Call

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

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

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