web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / DateDiff exclude weekend
Power Apps
Answered

DateDiff exclude weekend

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello everyone,

 

I use the following formula to calculate the Days between two dates excluding the weekend:

 

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

But the problem is, that the formula doesnt calculate right. F.e.

StartDate=03.04.2022 and EndDate=09.04.2022

you get the result "2" but the rightone is "5".

 

Have someone an idea, what can be the problem? It must been use quit a lot as I seen in the forum, so it might be right.

 

Sincerly Vinc

Categories:
  • WarrenBelz Profile Picture
    156,532 Most Valuable Professional on at

    Hi @Anonymous ,

    Congratulations - you have found a bug which seems to affect that 3 and 4 April but nothing else I can see. Try some other dates and you will see the formula is correct (which it is).

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Puh, I wont use that form it produce to many mistakes.

     

    Other example is, if ur Start.Date is 19.04.2022 and EndDate is 23.04.2022:

     

    Result = 4 days but correct is 3

     

    or 18.04.2022  to 23.04.2022 return "0".

     

    Its not usable!

     

    I try to built sth. else

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Found a way:

     

    1+((DateDiff(
    StartDate;
    EndDate;
    Days
    ))*5-((Weekday(StartDate)-Weekday(EndDate))*2))/7-Switch(
    Weekday(EndDate);
    7;
    1;
    0
    )-Switch(
    Weekday(StartDate);
    1;
    1;
    0
    )-CountIf(
    Tabelle1;
    Date >= StartDate;
    Date <= EndDate
    )

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard