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

Alteryx Designer Desktop Discussions

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

ISO Week number returning incorrect week number

BosKev
8 - Asteroid

Hey All,

 

I'm using the formula mentioned below to get a ISO week number but for date:1/2/2021 its turning week 53 instead of week 1, any ideas how to fix it? Thanks.

 

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Convert-date-to-week-number-of-that-ye...

 

PadLeft(ToString(FLOOR(DateTimeDiff(DateTimeAdd([Field1],4-Switch(DateTimeFormat([Field1],"%a"),7,"Mon",1,"Tue",2,"Wed",3,"Thu",4,"Fri",5,"Sat",6),"days"),DateTimeParse(ToString(ToNumber(DateTimeFormat(DateTimeAdd([Field1],4-Switch(DateTimeFormat([Field1],"%a"),7,"Mon",1,"Tue",2,"Wed",3,"Thu",4,"Fri",5,"Sat",6),"days"),"%Y")))+'-01-01',"%Y-%m-%d"),"days")/7)+1),2,"0")

4 REPLIES 4
kelsey_kincaid
12 - Quasar
12 - Quasar

Hi @BosKev ,

Based on ISO, it looks like week 53 does include 2021-01-02 based on the below hyperlink:

https://www.epochconverter.com/weeks/2021

 

Is there a different system you're wanting to use to reflect week number?

JagdeeshN
12 - Quasar
12 - Quasar

Hi @BosKev ,

 

Please find below a sample workflow to extract the week number.

 

I think you are looking at a date in the format MM-dd-yyyy thus making 1/2/2021 week 1.

 

Do let me know if this helps.

 

Best,

@JagdeeshN 

BosKev
8 - Asteroid

interesting, so the year 2021 counts backwards from week 53 to 1?

BosKev
8 - Asteroid

Nvm, one of my co-worker explained to me something bout the day count in 2020 that first few days is actually wk 53 for 2020. I just have to figure out a way to display to the end user. Thanks.

Labels