Hello Everyone,
I'm trying to find a solution for the total working hours in a week including Saturday's and Sunday's if worked.
Example:
Lets X person worked for two weeks form 07/04/2021 to 07/17/2021. Now I'm trying to find out the hours X worked in individual week.
I will really appreciate if I can get some direction.
Please find the attached samples.
Thanks in advance 🙂
Solved! Go to Solution.
Try:
In the Formula tool, use the expression DateTimeFormat(<date/time>, "%U") -- if you want the week to start from Sunday
or DateTimeFormat(<date/time>, "%W") -- Monday start of the week. This would return the week number of the year which you can then leverage on to group your data by.
You can also refer to https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Calculating-Week-Number-using-DateTime... to use another way around for getting the week number.
Group the data by their week number and IDs and then sum the hours worked using the summarize tool. Hope this helps!
@BA02 Can you help me with the workflow?
Hi @PNC97
Hope this is what you are looking for.
Workflow:
I have made 2 variations in upper branch week starts from Monday and lower branch week starts from Sunday.
1. Using formula to calculate first day of week. And convert working hours to seconds so that it can be summed up.
2. Using summarize tool groupby ID, Week start and sum of seconds.
3. Using formula tool to bring it to 00Hrs 00Mins format.
Hope this helps : )
@atcodesog05 this is perfect! @PNC97 hope this works for you.