Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

count of Week Days (Mon-Fri ) in a month

Hi Team,


Hope all are safe and sound.

I have a query. I need to know how we can find out the count of week days in a month.

like if i have a variable in which i have stored a date, from that date i need to find out in that month how many weekdays are there i.e., how many days are there in that particular month except all Saturdays and Sundays.


Looking forward for your suggestions..


Continued Contributor
Continued Contributor

Hi Jishnu, 


I have created similar flow , please see below steps to get count of weekends of month . 

1) Compose action to set start date of month


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


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 rangimage.pnge


5) Initialize weekend incremental counter variable 



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 



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



😎 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 1image.png

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




10) Check using flow checker & Test.


If this helps you , please mark as verified.

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (4,310)