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

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

Week Number Calculation

Atom

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,

Aurora

@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