Calling all Racers for the Alteryx Grand Prix! It's time to rev your engines and race to the stage at Inspire! Sign up here.

Alteryx Designer Discussions

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

Week number

SakshiVaid
5 - Atom

I'm trying to calculate the week number based on date. I've applied the formula:

 

Ceil((DateTimeDay([Date])+ToNumber(DateTimeFormat(Left([Date],8)+'01',"%w"))-1)/7)

 

using which i'm getting '6 weeks' which should not be the correct approach. Assuming that the week starts on Monday. I've attached the workflow below. Could someone please help me with the same.

3 REPLIES 3
RolandSchubert
16 - Nebula
16 - Nebula

Hi,

 

your calculation seems to return the correct results:

2017-07-01 is Saturday => Week 1 of July (week consists of Saturday + Sunday only)

2017-07-03 - 2017-07-09 => Week 2

2017-07-10 - 2017-07-16 => Week 3

2017-07-17 - 2017-07-23 => Week 4

2017-07-24 - 2017-07-30 => Week 5

2017-07-31 => Week 6 of July (only Monday)

 

Maybe it is a solution to start week count with first Monday is month (or first week in month with at least 4 days)?

 

Best regards

 

Roland

SakshiVaid
5 - Atom

Hi , Thanks for the revert.

 

Could you please help me with the workings using Alteryx and attach the file with the solution for this statement:

"Maybe it is a solution to start week count with first Monday is month (or first week in month with at least 4 days)?"

 

Thanks, Sakshi

 

NHagen1907
5 - Atom

Were you able to find a solution?  If so could you please share?

Labels