cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mrunal
Advocate I
Advocate I

Date Difference excluding Weekends

If I want to calculate difference between two dates excluding weekend(Saturday, Sunday). How to achieve this? Suggest some help.

1 ACCEPTED SOLUTION

Accepted Solutions
Steelman70
Power Participant
Power Participant

Here is the screenshot and formulas for each line below, frankly it should be possible to simplify but I could not see how...

 

 

 

CaptureWeekDays.PNG

 

Date(2016,6,15)

 

Date(2016,6,27)

 

DateDiff(DateValue(Date1.Text, "it" ), DateValue(Date2.Text, "it" ))

 

Mod(CalDays.Text,7)

 

Mod(DateDiff(Date(2000,1,3), DateValue(Date1.Text, "it" )),7)+1

 

Weekday1.Text+CalDaysMod7.Text

 

If(CalDaysMod7.Text="0",0, If(Value(Weekday2x.Text) < 7, CalDaysMod7.Text, If(Weekday2x.Text="7", Max(CalDaysMod7.Text-1,0), CalDaysMod7.Text-Min(2,8-Weekday1.Text))))

 

RoundDown(CalDays/7,0)*5+ExtraDays

Basically it is whole weeks*5 plus an adjustment for the extra days depending on how many week-end days they include

View solution in original post

3 REPLIES 3
hngdev
Resolver II
Resolver II

I think you can you use DateDiff function to do so:

- Use DateDiff with day unit > get days

- Use days to get weeks

- Multiply weeks by 2 for weekends

- Get days minus weekends

Hope it helps

Steelman70
Power Participant
Power Participant

Here is the screenshot and formulas for each line below, frankly it should be possible to simplify but I could not see how...

 

 

 

CaptureWeekDays.PNG

 

Date(2016,6,15)

 

Date(2016,6,27)

 

DateDiff(DateValue(Date1.Text, "it" ), DateValue(Date2.Text, "it" ))

 

Mod(CalDays.Text,7)

 

Mod(DateDiff(Date(2000,1,3), DateValue(Date1.Text, "it" )),7)+1

 

Weekday1.Text+CalDaysMod7.Text

 

If(CalDaysMod7.Text="0",0, If(Value(Weekday2x.Text) < 7, CalDaysMod7.Text, If(Weekday2x.Text="7", Max(CalDaysMod7.Text-1,0), CalDaysMod7.Text-Min(2,8-Weekday1.Text))))

 

RoundDown(CalDays/7,0)*5+ExtraDays

Basically it is whole weeks*5 plus an adjustment for the extra days depending on how many week-end days they include

Anonymous
Not applicable

Thanks for the post.It's working great!!!!!

Helpful resources

Announcements
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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

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

PA Virtual Workshop Carousel 768x460.png

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.

PA.JPG

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 (2,042)