Alteryx Designer Desktop Discussions

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

How to calculate week number

sgaryali
8 - Asteroid

Hi

 

I want to get the week number for the week but week should start from Monday to Sunday.

 

For ex - Date = calendar week (EX 2021-11-03 = wk45) 

 

and then rest of the column will be totaled by employee ID  and week.

 

How can we do that?

 

6 REPLIES 6
AngelosPachis
16 - Nebula

Hi @sgaryali ,

 

To get the week number out of the date field, try the following expression:

 

DateTimeFormat([Date],"%W")

 

AngelosPachis_0-1639138894334.png

You can learn more about the datetime functions within Alteryx through the following link:

 

https://help.alteryx.com/20213/designer/datetime-functions

 

Hope that helps,

Angelos

sgaryali
8 - Asteroid

Hi @AngelosPachis 

 

Thank you for your reply.

But this not what I am looking at.

 

Basically I want week number for the whole week for ex - 01/11/2021 to 07/11/2021 - Wk 45 and week should always start from Monday and end at Sunday.

Then rest of the column calculation will be totaled by employee ID and week.

 

 

AngelosPachis
16 - Nebula

Hi @sgaryali ,

 

If you're looking for the ISO weeknumber, maybe you try following the solution of this post:

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Calculating-Week-Number-using-DateTime...

 

The links included in the following link can also be very useful

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/ISO-WeekNumber-Calculation-which-gives...

 

Let me know if that works for you 🙂

 

Cheers,

Angelos

Sebastiaandb
12 - Quasar

@sgaryali ,

 

Is this what you're looking for?

 

Sebastiaandb_0-1639141879834.png

Greetings,

 

Seb

Monica_
6 - Meteoroid

Hello,

 

We are currently building a workflow which gets the week number. But a week must be from Saturday to Friday. Any possible solution for this? Thanks.

 

 

 

PS. solved already: 

 

IF [Day] In ("Sat", "Sun")
THEN ToNumber([Week_Number_Default]) +1
ELSE [Week_Number_Default]
ENDIF

 

Feel free to comment if it's not working or wrong ðŸ˜€

katherine11223
5 - Atom

You can use the Week Calculator to accurately find the week numbes. It will help you determine the correct calendar week for any date. Simply enter your date, and the tool will do the rest!

Labels
Top Solution Authors