Power Apps Exchange

Please login or click SIGN UP FOR FREE to create your PowerAppsUG account to join this user group.
 View Only
  • 1.  Network Days function calculates wrong

    Posted Sep 07, 2021 07:46 AM
    I am using the network days function provided in github.
    powerfx-samples/samples/date-functions at main · pnp/powerfx-samples


    In some months, it calculates the wrong amount of working days and i dont find the issue.

    Example:

    September --> Works (22 days is correct)


    But some other months are wrong.
    In august, there are 22 working days, but it shows 23.



    I am simply counting the days without saturdays and sundays.


    ------------------------------
    Fabian Heil
    ------------------------------


  • 2.  RE: Network Days function calculates wrong
    Best Answer

    Top Contributor
    Posted Sep 08, 2021 01:03 AM
    Try this:
    CountIf(
        AddColumns(
            Sequence(
                DateDiff(
                    StartDate,
                    EndDate,
                    Days
                ) + 1,
                0
            ),
            "Weekday",
            Weekday(
                DateAdd(
                    StartDate,
                    Value,
                    Days
                )
            ) in [2,3,4,5,6]
        ),
        Weekday
    )​


    ------------------------------
    Will Page
    Technical consultant
    Christchurch, NZ
    ------------------------------



  • 3.  RE: Network Days function calculates wrong

    Silver Contributor
    Posted Sep 08, 2021 02:59 AM
    I don't know of which month this is a screenshot, but August has 31 days and not 30 so 23 working days could be correct

    ------------------------------
    Koen Mathijs
    ------------------------------



  • 4.  RE: Network Days function calculates wrong

    Posted Sep 08, 2021 03:17 AM
    Ah yes, sorry. The screenshot was the wrong month. This is august, but anyway 22 days.


    But the formula from Will Page works :) Thanks a lot!

    ------------------------------
    Fabian Heil
    ------------------------------



  • 5.  RE: Network Days function calculates wrong

    Posted Sep 09, 2021 03:28 AM
    Hey all,

    I'm new to Power Apps But use Power BI, i found this document on using a dataflow in power Apps: Create and use dataflows in Power Apps - Power Apps | Microsoft Docs

    Could you not pull a calender date table through which has all the workdays and have a simpler count to count the work days?


    Kind Regards

    Jimmy

    ------------------------------
    Kind Regards,

    Jimmy Dawe
    Solutions support officer
    Glenrothes
    7549888812
    ------------------------------



  • 6.  RE: Network Days function calculates wrong

    Top Contributor
    Posted Sep 09, 2021 03:48 AM
    This is a premium feature unfortunately. For most businesses it's hard to justify the price of a premium license for each user.


    ------------------------------
    Will Page
    Technical consultant
    Christchurch, NZ
    ------------------------------



  • 7.  RE: Network Days function calculates wrong

    Posted Sep 09, 2021 04:15 AM
    I understand we are still Pro too. We are looking it the Premium Per User (PPU), but it does ramp up the costs.

    ------------------------------
    Kind Regards,

    Jimmy Dawe
    System Specialist
    Glenrothes
    7549888812
    ------------------------------