NETWORKDAYS

How to Use the Power BI DAX function NETWORKDAYS

Here’s how to use the NETWORKDAYS function in Power BI.

Syntax of the NETWORKDAYS function

The syntax of the NETWORKDAYS function is as follows:


NETWORKDAYS(start_date, end_date, [holidays])


- `start_date`: The start date for the calculation.

- `end_date`: The end date for the calculation.

- `[holidays]`: An optional parameter that specifies the dates to exclude from the calculation.

How to use the NETWORKDAYS function

To use the NETWORKDAYS function, follow these steps:

1. Open Power BI and create a new report.

2. Select a visual or create a new one that requires the use of the NETWORKDAYS function.

3. Add a measure to your visual. Click on the "New measure" button in the "Fields" pane.

4. In the formula bar, enter the following formula:


My Measure = NETWORKDAYS([Start Date], [End Date], [Holidays])


5. Replace "My Measure" with the name you want to give your measure.

6. Replace "[Start Date]" and "[End Date]" with the appropriate column names that contain the start and end dates for your calculation.

7. If you need to exclude holidays from your calculation, replace "[Holidays]" with the appropriate column name that contains the list of holidays.

Examples of using the NETWORKDAYS function

Here are a few examples of how to use the NETWORKDAYS function in Power BI.

Example 1: Calculate the number of working days between two dates

Suppose you have a table with two columns, "Start Date" and "End Date," and you want to calculate the number of working days between these two dates. Here's how you can do it using the NETWORKDAYS function:

1. Create a new measure using the formula:


Working Days = NETWORKDAYS([Start Date], [End Date])


2. Add the "Working Days" measure to your visual.

Example 2: Exclude weekends and holidays from the calculation

Suppose you want to exclude weekends and holidays from the calculation of working days between two dates. Here's how you can do it using the NETWORKDAYS function:

1. Create a new measure using the formula:


Working Days = NETWORKDAYS([Start Date], [End Date], Holiday[Date])


2. Add the "Working Days" measure to your visual.

Note: In this example, "Holiday" is the name of the table that contains the list of holidays. "Date" is the name of the column in the "Holiday" table that contains the holiday dates.

The NETWORKDAYS function in Power BI is a powerful tool that can help you calculate the number of working days between two dates, taking into account weekends and holidays. By following the steps outlined in this article, you can easily use this function in your Power BI reports to create accurate project timelines or business schedules.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)