Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

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

Week number from date - starting from 1

Krzysztof_Hyla
5 - Atom

Hi.

 

What is the formula to extract week number from date?

I used this formula so far:

DateTimeFormat([Date], '%W')

 

But it starts to count from 0 if the first day of the year is not Monday.

How to make it count from 1?

 

 

4 REPLIES 4
ChrisTX
16 - Nebula
16 - Nebula

Can you convert the Week to numeric, then add 1?

 

Krzysztof_Hyla
5 - Atom

I can, but this will result in having first week of year 2018 and 2024 as number 2 (because 1st Jan is Monday)

I can hardcode an exception for these years, but I'm rather looking for a consistent formula if possible

ChrisTX
16 - Nebula
16 - Nebula

See if the attached workflow gives the results you want

 

Chris

ChrisTX
16 - Nebula
16 - Nebula

For additional common date dimensions

 

see this post:

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Using-drop-down-list-boxs-to-populate-...

 

and look at the file Date_Solution.yxzp, which includes the macro Dim_Datetime_Custom.yxmc

 

Chris

Labels
Top Solution Authors