Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

working hours cal

PNC97
8 - Asteroid

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 🙂

 

 

4 REPLIES 4
BA02
7 - Meteor

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!

PNC97
8 - Asteroid

@BA02 Can you help me with the workflow?

atcodedog05
22 - Nova
22 - Nova

Hi @PNC97 

 

Hope this is what you are looking for.

Workflow:

atcodedog05_0-1629783891849.png

 

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 : )

 

BA02
7 - Meteor

@atcodesog05 this is perfect! @PNC97 hope this works for you.

Labels