Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
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!

  • Chriddle Profile Picture
    7,652 Super User 2025 Season 1 on at
    Re: Calculate weekdays in approval process

    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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow