skip to main content
Power BI
    • What is Power BI
    • Why Power BI
    • Customer stories
    • Data visuals
    • Security
    • Power BI Desktop
    • Power BI Pro
    • Power BI Premium
    • Power BI Mobile
    • Power BI Embedded
    • Power BI Report Server
  • Pricing
    • Azure + Power BI
    • Microsoft 365 + Power BI
      • Energy
      • Healthcare
      • Manufacturing
      • Media
      • Retail
    • For analysts
    • For IT
      • Overview
      • Embedded analytics
      • Power BI visuals
      • Automation
      • Documentation
      • Community
    • Overview
    • Find consulting services
    • Partner showcase
    • Find a partner
    • Become a partner
    • Instructor-led training
    • Getting started
      • Overview
      • Online workshops
      • Self-guided learning
      • Webinars
      • Documentation
      • Roadmap
      • Overview
      • Issues
      • Give feedback
    • Blog
    • Business intelligence topics
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Events
    • User groups
    • Community blog
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Galleries
    • Community Connections & How-To Videos
    • COVID-19 Data Stories Gallery
    • Themes Gallery
    • Data Stories Gallery
    • R Script Showcase
    • Webinars and Video Gallery
    • Quick Measures Gallery
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Events
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power BI Community
    • Galleries
    • Quick Measures Gallery
    • Power BI: DAX Function NETWORKDAYS

    Power BI: DAX Function NETWORKDAYS

    08-06-2022 10:41 AM - last edited 08-07-2022 19:59 PM

    Super User amitchandak
    Super User
    366 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    amitchandak
    Super User amitchandak
    Super User
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    Power BI: DAX Function NETWORKDAYS

    ‎08-06-2022 10:41 AM

    Power BI: DAX Function NETWORKDAYS

    Power BI(162).png

     


    Power BI in July 2022 has released a new DAX function Networkdays.
    I would like to explore the same here. I have uploaded the file used in this blog on GitHub. There are two tables. One with two dates to get networkdays and the second having US holidays for the Year 2022.

     

    Networkdays function can take 4 parameters and the last two are optional
    1. Start Date
    2. End Date 
    3. Week End
    4. Holidays


    Power BI has given various weekend options, which you can find in the document. The common one is 1 which means the weekend is Saturday and Sunday


    The traditional method to get the workdays between two dates was 


    Work Days Traditional 1 = Countrows(filter( CALENDAR([Date1],Dates[Date2]), WEEKDAY([Date],2) <6 ))

     

    The same can be achieved using 
    Work Days 1 = NETWORKDAYS(Dates[Date1],Dates[Date2],1)

     

    You can add holidays using the table, for example, manual table addition 
    Work Days 2 = NETWORKDAYS(Dates[Date1],Dates[Date2],1, {Date(2022,1,17)})

     

    In the old method, you need to do 
    Work Days Traditional 2 = Countrows(filter( CALENDAR([Date1],Dates[Date2]), WEEKDAY([Date],2) <6 && not [Date] in {Date(2022,01,17)}))

     

    You can use a calendar table, I will use the one I loaded into the file. I have more than one column. I am taking only one. I can use distinct to all.
    Work Days = NETWORKDAYS(Dates[Date1],Dates[Date2],1, distinct(Holidays[Date]))

     

    In the old method, you need to do
    Work Days Traditional = Countrows(filter( CALENDAR([Date1],Dates[Date2]), WEEKDAY([Date],2) <6 && not [Date] in distinct(Holidays[Date])))

     

    Please let find the blog here. Like, Share, and Comment.



    Microsoft Power BI Learning Resources, 2023 !!
    Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
    Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
    Formatted Profit and Loss Statement with empty lines
    Networkdays Data1.pbix
    11 KB
    Labels:
    • Labels:
    • Financial
    • Mathematical
    • Time Intelligence
    Message 1 of 1
    366 Views
    0
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign in
    • Sign up

    Browse

    • Solutions
    • Partners
    • Consulting Services

    Downloads

    • Power BI Desktop
    • Power BI Mobile
    • Power BI Report Server
    • See all downloads

    Learn

    • Guided learning
    • Documentation
    • Support
    • Community
    • Give feedback
    • Webinars
    • Developers
    • Blog
    • Newsletter

    © 2023 Microsoft

    Follow Power BI

    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Trademarks
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices