cancel
Showing results for
Search instead for
Did you mean:
Frequent Visitor

## DateDiff exclude weekend

Hi,

I'm building leave request for my team, on the submit page I want to show number of leave days selected using DateDiff but the problem is I need to exclude weekend.

As this scenario 11 is Friday and 14 is Monday so Total date shall be 2 (weekend excluded)

Any solution for this, Thank you for your help 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

Hi @MIGHSKI

This formula should work for you, and calculate the difference *inclusive* of the start and end date. You would obviously replace the startDate and endDate values with references to your date picker controls. :

``````With({ startDate:DateValue("2022-02-11"),
endDate:DateValue("2022-02-14")
},
RoundDown(DateDiff(startDate, endDate, Days) / 7, 0) * 5 +
Mod(5 + Weekday(endDate) - Weekday(startDate), 5)
+ 1
)``````

The caveat with this formula is that the start and end dates must not be weekend dates.

3 REPLIES 3
Super User

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Last Post on Community

My website!

Super User

Hi @MIGHSKI

This formula should work for you, and calculate the difference *inclusive* of the start and end date. You would obviously replace the startDate and endDate values with references to your date picker controls. :

``````With({ startDate:DateValue("2022-02-11"),
endDate:DateValue("2022-02-14")
},
RoundDown(DateDiff(startDate, endDate, Days) / 7, 0) * 5 +
Mod(5 + Weekday(endDate) - Weekday(startDate), 5)
+ 1
)``````

The caveat with this formula is that the start and end dates must not be weekend dates.

Frequent Visitor

Hooray !! It's work fine, again thanks for your help 🙂

## Helpful resources

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.

#### Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

#### 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 (3,866)