web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Calculate weekdays in ...
Power Automate
Unanswered

Calculate weekdays in approval process

(0) ShareShare
ReportReport
Posted on by

Hi,


I have an approval workflow where by i am using ticks to calculate days between request and completion date. Can you please help in how to only calculate weekdays?


thank you in advance!

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    There certainly is a propper algo for this, but you can also let PA do the work 🙂

    Here is my brute force solution:

    Chriddle_0-1689353490644.png

    Select

    From (This is a range from 0 to number of days, including end date):

    range(
    	0,
    	int(
    		split(
    			dateDifference(
    				outputs('Dates')['start'],
    				addDays(
    					outputs('Dates')['end'],
    					1
    				)
    			),
    			'.'
    		)[0]
    	)
    )

     Map (Check if weekday is 0 or 6. If so return , else 1):

    if(
    	contains(
    		createArray(0,6),
    		dayOfWeek(
    			addDays(
    				outputs('Dates')['start'],
    				item()
    			)
    		)
    	),
    	0,
    	1
    )

     

    Compose

    Input (Add all the numbers in the array created with the Select):

    xpath(
     xml(
     json(
     concat(
     '{"root":{"Number":',
     body('Select'),
     '}}'
     )
     )
     ),
     'sum(/root/Number)'
    )

     

     Output: 5

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard