The use of the datediff formula in Alteryx makes it easy to count how many days there are between two dates, but what if you only wanted to count the weekdays?
Here’s the method I use, and it can be done is as little as 4 tools. I’ve counted the number of weekdays between Order Date and Ship Date in the Sample Superstore data.
The select tool is optional, I’ve added it here to narrow down the number of fields to only those I’ll be using in the workflow.
Generate Rows Tool|
This tool will create a new row for every date between the [Order Date] and the [Ship Date]. Each row is generated with the date being one day further along than the previous row.
Formula Tool|
This tool will create a new field, calculating the day of the week for every date in the DateBetween field (Created in the previous tool).
Filter Tool|
This will filter out any rows where the Day of the Week was a Saturday or Sunday (The Weekend), leaving only the weekdays.
Summarize Tool|
This setup means the tool will group any rows containing the same OrderID together. Within these groups the daysofweek are counted. The outcome of this count will the number of weekdays between our Order Date and Ship Date.
I hope you’ve found this quick Alteryx tip helpful. I know when I found out it was definitely useful for me.