Skip to main content
Power Automate
    • Robotic process automation
    • Power Automate Desktop
    • Process advisor
    • AI Builder
    • Connectors
    • Templates
  • Pricing
    • Blog
    • Documentation
    • Roadmap
    • Self-paced learning
    • Webinar
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • Register
    • ·
    • Sign In
    • ·
    • Help
    Go To
    • Microsoft Power Automate Community
    • Community News
    • News & Announcements
    • Get Help with Power Automate
    • General Power Automate Discussion
    • Connecting To Data
    • Building Flows
    • Using Flows
    • Power Automate Desktop
    • AI Builder
    • Power Automate Mobile App
    • Translation Quality Feedback
    • Share, Chat, Discuss
    • Community Chat & Announcements
    • Power Automate Cookbook
    • Off Topic Discussion
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Watch & Share Videos
    • Webinars and Video Gallery
    • MBAS Gallery 2019
    • MBAS Gallery 2020
    • Give Feedback & Share Ideas
    • Power Automate Ideas
    • Report Issues
    • I Found A Bug
    • Find & Join Local User Groups
    • Power Automate User Groups
    • Read & Share Blogs
    • Power Automate Community Blog
    • Community Blog Topic Suggestions
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    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 Automate Community
    • Forums
    • Share, Chat, Discuss
    • Power Automate Cookbook
    • Find Working Days of Month

    Find Working Days of Month

    05-24-2020 03:41 AM

    anupam8555
    Resolver II
    259 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    anupam8555
    anupam8555 Resolver II
    Resolver II
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Email to a Friend
    • Report Inappropriate Content

    Find Working Days of Month

    ‎05-24-2020 03:41 AM

    Hello folks, 

    As there are not any OOB endpoint for getting working days of a month or date range. I have created this flow to get working days i.e. excluding Saturday and Sunday of Month. You can customize according to you needs.

    Follow below steps :

    1) Compose action to set start date of month

    image.png

    2) create compose action again to set end date of month using following expression :

    subtractFromTime(startOfMonth(addToTime(outputs('Compose'),1,'Month')),1,'Day')
     
    image.png
     

    3) Initialize variable to set Start_Date as string and value of output #1 compose

     

    4) Initialize an array - as array output of #1 compose . This is going to be used to loop through between date rang

     

    5) Initialize weekend incremental counter variable 

    image.png

    6) Create Do Until loop - set 'Start_Date' and compare output value with 'Compose_3' i.e. #2 step

     
    •  Create compose action again to add 1 day into start date with expression as follows : addDays(variables('Start_Date'),1)
    •  Now add action to set variable value of 'Start_Date' from previous compose output
    •  Add append to array variable - Select 'Date_Array' with value of 'Start_Date' - This is going to append array variable 

    image.png

    7) Now after Do until, create action to compose array output for 'Date_Array'

     
     

    image.png

     
     

    Add apply to each loop - This is going to iterate through each dates we added in 'DateArray'

    • Add conditions in each loop to check day is weekend or not using following condition : (Use OR)
      dayOfWeek(items('Apply_to_each')) is equal to 6
      dayOfWeek(items('Apply_to_each')) is equal to 0
    • In Yes action , Increment Weekend variable to 1
       

    image.png

    9) Now After apply to each , create a new compose action with input of 'Weekend'. This is going to show you number of weekends of month.

    image.png

    10) Check using flow checker & Test.

     

    If you have any questions or concerns , please feel free to reach out to me. 

    Preview file
    28 KB
    FindWorkingDaysofaMonth_20200524100627.zip
    Labels:
    • Labels:
    • Automated Flows
    • Button Flows
    • Scheduled flows
    Message 1 of 1
    259 Views
    0 Kudos
    Reply
    • All posts
    • Previous Topic
    • Next Topic

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Automate
    • Power Virtual Agents
    • Sign up free
    • Sign in

    Browse

    • Templates
    • Connectors
    • Partners

    Downloads

    • Mobile
    • Gateway

    Learn

    • Documentation
    • Learn
    • Support
    • Community
    • Give feedback
    • Blog
    • Pricing
    • © 2021 Microsoft
    • Twitter
    • RSS Feed
    • YouTube
    • Contact us
    • Trademarks
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Terms & conditions