Start Free Trial

Alteryx Designer Desktop Discussions

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

Week VSring to Week Date format

AntlRo
8 - Asteroid

Hello,

 

 

I have a column called week with data type V_string  as such below :

 

 

WeekCategory
09-13 Jan 2023Orange
16-20 Jan 2023Apple

 

I want to convert the week column to week format as such(keep in mind the data has hundreds of rows) :

 

WeekCategory
2Orange
3Apple
4 REPLIES 4
DataNath
17 - Castor
17 - Castor

Hey @AntlRo, is your incoming week range field in a consistent format i.e. that of the 2 examples above? Could perhaps try something like this:

 

DataNath_0-1675194786880.png

DateTimeFormat(DateTimeParse(Right([Week],11),'%d %b %Y'),'%W')

 

If you don't want the leading zeros in numbers 1-9, you can just add a TrimLeft() like so:

 

TrimLeft(DateTimeFormat(DateTimeParse(Right([Week],11),'%d %b %Y'),'%W'),'0')
AntlRo
8 - Asteroid

this works great now how would you split it to get two columns( the second being in date format say first day of the week) as such..

 

WeekCategory
09-13 Jan 2023Orange
16-20 Jan 2023Apple

 

Desired Output:

new Columns:

WeekDate Category
21/9/2023Orange 
31/16/2023Apple
DataNath
17 - Castor
17 - Castor

@AntlRo there's a bunch of ways you could go about doing this but here's one way:

 

DataNath_0-1675241701901.png

AntlRo
8 - Asteroid

Thanks!

Labels
Top Solution Authors