Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Assign WeekNum to each month

mlgsleea
5 - Atom

Hello,

 

I am trying to indentify each weeknum for every month for the data that I have. I used formula to indentify weeknum, but this is for whole year.

Is there a way to sepeate weeknum for each month? Everymonth should start with Weeknum 1.

 

DateTimeFormat([Shipped Date],"%W")

 

Thank you.

2 REPLIES 2
JohnJPS
15 - Aurora

This is a little ugly but, using "%W" to get "yearly weeknum" for both the date in question, and the first of the month of the date in question... their difference should then give the "weeknum within the month of the date in question":

1 + ToNumber(DateTimeFormat([InDate],"%W")) - 
ToNumber(DateTimeFormat(DateTimeAdd([InDate], 1 - ToNumber(DateTimeFormat([InDate],"%d")),"days"),"%W"))

 

RodL
Alteryx Alumni (Retired)

Assuming your weeks have a 'start date', you could just use a Multi-Row formula tool that checks if the month name on the previous row is the same...if it is, increment the week number...if it isn't, start again at 1.

Labels