Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

DAX (NetWorkDays)

Hi all,

 

How to calculate the number of working days  in PowerBI by dates?

 

For eg: In excel, I have dates starting from 5/7/21 to 8/5/21 which is 91 days.

And to calculate working days, I have used =NETWORKDAYS(B6,CN6).

 

How can I implement the same in PowerBI? 

 

Any help is appreciated!

 

Thank you!

Megha

2 Replies

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    Hi,

    Calculating working days in DAX is a bit more difficult than in excel. I recommend cheking this article by SQLBI: https://www.sqlbi.com/articles/counting-working-days-in-dax/

    They explain what to do well. In essence you want have an indicator column in your calendar table whether or not a day is working day. In addition to weekends you can have a calendar with public holidays, but this is a story on its own. 

    I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

    My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please refer to the following steps to see if it helps you.

    1. Prerequisite should include a date range
    2. Create DAX logic to generate a column that calculates Total Workdays excluding weekends
    3. Create DAX logic that calculates Total Workdays excluding public holidays
    4. Verify the final output using filters in the DatesTable

    More details:Calculate Working Days in Power BI 

     

    I have also found a similar post, please refer to it to see if it helps you.

    https://community.powerbi.com/t5/Desktop/WORKDAY-formula-in-Power-BI/m-p/202383

     

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.