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

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

Calculate Networking days

(1) ShareShare
ReportReport
Posted on by 549
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!
I have the same question (0)
  • WarrenBelz Profile Picture
    151,759 Most Valuable Professional on at
    Calculate Networking days
     
    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
    549 on at
    Calculate Networking days
     
    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
    35,805 Super User 2025 Season 2 on at
    Calculate Networking days
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 671 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 424 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard