NETWORKDAYS DAX Function (Date and Time)

Returns the number of whole workdays between two dates (inclusive) using parameters to indicate which and how many days are weekend days. Weekend days and any days that are specified as holidays are not considered as workdays.

Syntax

NETWORKDAYS ( <start_date>, <end_date> [, <weekend>] [, <holidays>] )
Parameter Attributes Description
start_date

A date that represents the start date.

end_date

A date that represents the end date.

weekend Optional

Indicates the days of the week that are weekend days and are not included in the number of whole working days between start_date and end_date. Weekend is a weekend number that specifies when weekends occur. Weekend number values indicate the following weekend days: 1 or omitted: Saturday, Sunday; 2: Sunday, Monday; 3: Monday, Tuesday; 4: Tuesday, Wednesday; 5; Wednesday, Thursday; 6: Thursday, Friday; 7: Friday, Saturday; 11: Sunday only; 12: Monday only; 13: Tuesday only; 14: Wednesday only; 15: Thursday only; 16: Friday only; 17: Saturday only.

holidays Optional

A single column table of one or more dates that are to be excluded from the working day calendar.

Return values

Scalar A single integer value.

Returns the number of whole workdays between two dates (inclusive).

» 1 related article

Examples

-- Count the working days in May 2022 
-- ignoring any holiday
EVALUATE 
UNION ( 
    ROW ( 
        "Type", "Sat/Sun", 
        "Working Days", NETWORKDAYS ( 
            dt"2022-05-01", 
            dt"2022-05-31", 
            1               -- Ignore Saturday and Sunday
        )
    ),
    ROW ( 
        "Type", "Sunday", 
        "Working Days", NETWORKDAYS ( 
            dt"2022-05-01", 
            dt"2022-05-31", 
            11               -- Ignore only Sunday
        )
    ),
    ROW ( 
        "Type", "Sat/Sun + Memorial Day", 
        "Working Days", NETWORKDAYS ( 
            dt"2022-05-01", 
            dt"2022-05-31", 
            1,                 -- Ignore Saturday and Sunday
            { dt"2022-05-30" } -- Ignore Memorial Day (US)
        )
    )
)
Type Working Days
Sat/Sun 22
Sunday 26
Sat/Sun + Memorial Day 21
DEFINE
    VAR HolidaysDates =
        CALCULATETABLE ( 
            DISTINCT ( 'Date'[Date] ), 
            'Date'[Is Holiday] = 1 
        )
    VAR SalesDecember =
        CALCULATETABLE (
            SUMMARIZE (
                Sales,
                Sales[Order Number],
                Sales[Order Date],
                Sales[Delivery Date]
            ),
            Sales[Order Date] = dt"2008-12-23"
        )

EVALUATE
TOPN (
    10,
    SELECTCOLUMNS (
        SalesDecember,
        Sales[Order Number],
        Sales[Order Date],
        Sales[Delivery Date],
        "Delivery Working Days", NETWORKDAYS ( 
            Sales[Order Date], 
            Sales[Delivery Date], 
            1,
            HolidaysDates
        ) - 1
    )
)
Order Number Order Date Delivery Date Delivery Working Days
200812235CS669 2008-12-23 2008-12-31 5
200812235CS669 2008-12-23 2008-12-30 4
200812233CS669 2008-12-23 2008-12-30 4
200812233CS669 2008-12-23 2008-12-29 3
200812234CS669 2008-12-23 2008-12-29 3
200812234CS669 2008-12-23 2009-01-03 6
200812234CS669 2008-12-23 2009-01-02 6
200812233CS669 2008-12-23 2008-12-31 5
200812238CS669 2008-12-23 2009-01-03 6
200812238CS669 2008-12-23 2009-01-02 6

Related articles

Learn more about NETWORKDAYS in the following articles:

Last update: Nov 14, 2024   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

Microsoft documentation: https://learn.microsoft.com/dax/networkdays-dax

2018-2024 © SQLBI. All rights are reserved. Information coming from Microsoft documentation is property of Microsoft Corp. » Contact us   » Privacy Policy & Cookies

Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Volatile

A volatile function may return a different result every time you call it, even if you provide the same arguments. Click to read more.

Deprecated

This parameter is deprecated and its use is not recommended.

DirectQuery compatibility

Limitations are placed on DAX expressions allowed in measures and calculated columns.
The state below shows the DirectQuery compatibility of the DAX function.

Contribute

Want to improve the content of NETWORKDAYS? Did you find any issue?
Please, report it us! All submissions will be evaluated for possible updates of the content.


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.