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!
There certainly is a propper algo for this, but you can also let PA do the work 🙂
Here is my brute force solution:
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
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional