community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Week Number Calculation

Highlighted
Meteoroid

Hi All,

 

I have a requirement to calculate the week numbers from week 1 - 54. However, the below Alteryx specifier calculates the week numbers from 00 - 53:

 

tonumber(DateTimeFormat([DateTime_Out],"%W"))

 

Any ideas/example code to return the week numbers from 1-54.

Alteryx Certified Partner
Alteryx Certified Partner

Hi @UmarS

 

ToNumber(DateTimeFormat([DateTime_Out],"%W")) + 1

 

Have you tried that? It seems simple, but it's the first thing that came up to my mind.

 

Cheers,

Nebula
Nebula

@Thableaus sometimes the obvious ones are correct!

 

@UmarS  One thing to watch out for is that the %W assumes that the week starts on Monday.  This could throw you off by another week if your "week" starts on Sunday and January first is a Sunday.  This happened in 2017.  Note that I'm using Thableaus "+1" week calculation

 

Weeknumber.png

 

Dan

Labels