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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Calculate Networking days
Power Apps
Unanswered

Calculate Networking days

(1) ShareShare
ReportReport
Posted on by 652
Hello,
 
I'm looking for a formula to calculate network days between 2 dates.
 
I have 2 columns i.e. Start Date and End Date and need to have the no. of days in a column called Status
 
Below is the formula which I'm using in excel. How can we have a similar formula in the PowerApp form
 
=IF($B2="","In Progress",IF(NETWORKDAYS($A2,$B2)<=2,"OK","NOT OK")) - Column B is the End Date and column A is Start Date in excel
 
When End date is blank, show text as "In Progress" in the Status column and if dates, calculate no. of network days.
 
Please advise. Thanks!
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • Prem4253 Profile Picture
    652 on at
     
    I've already gone through the link that you provided. I keep getting the below error message.
     
     
    The below code gives the correct output but I'm concern about the error message.
     
    With(
        {
            // generate a one-column table of all dates between start date & end date
            varDateRange: ForAll(
                Sequence(dte_EndDate.SelectedDate - dte_StartDate.SelectedDate + 1),
                dte_StartDate.SelectedDate + Value - 1
            )
        },
        If(
            And(
                IsBlank(dte_StartDate.SelectedDate),
                IsBlank(dte_EndDate.SelectedDate)
            ),
            // show nothing if any date pickers are blank
            0,
            // include only dates Monday to Friday
            CountIf(
                varDateRange,
                Weekday(Value) in [2, 3, 4, 5, 6]
            )
        )
    )
     
     
  • timl Profile Picture
    36,415 Super User 2025 Season 2 on at
    Hi  Prem4253
     
    I've just tested this and I think this is an issue with the SelectedDate property of the Modern DatePicker control returning a sequence amount that's out of range. This doesn't seem to happen with the classic date picker control.
     
    In either case, this variation that contains some additional validation appears to solve the problem. 
     
    With(
        {varSequenceAmount: dte_EndDate.SelectedDate - dte_StartDate.SelectedDate + 1},
        With(
            {
                // generate a one-column table of all dates between start date & end date
                varDateRange: ForAll(
                    Sequence(
                        If(
                            varSequenceAmount < 0 || varSequenceAmount > 50000,
                            0,
                            varSequenceAmount
                        )
                    ),
                    dte_StartDate.SelectedDate + Value - 1
                )
            },
            If(
                And(
                    IsBlank(dte_StartDate.SelectedDate),
                    IsBlank(dte_EndDate.SelectedDate)
                ),
            // show nothing if any date pickers are blank
                0,
            // include only dates Monday to Friday
                CountIf(
                    varDateRange,
                    Weekday(Value) in [
                        2,
                        3,
                        4,
                        5,
                        6
                    ]
                )
            )
        )
    )
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard