Alteryx Designer Desktop Discussions

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

Add column for yyyy-mm-dd

traceystone
8 - Asteroid

I have a set of data that I would like to add a column with date format YYYY-MM-DD as shown below. Looking at columns A and B to determine the month and year. Ideas?

 

 

traceystone_1-1649975632379.png

 

5 REPLIES 5
Qiu
21 - Polaris
21 - Polaris

@traceystone 
I can think of two ways 

1. Use the DateTimeParse function to convert the string 'yyyy-mm' in to  Date format data

2. Use the DateTime tool to parse the string 'yyyy-mm' in to  Date format data
of course, the Year and month in your date look like integer, we need first convert them to String.

0415-traceystone.PNG

MarqueeCrew
20 - Arcturus
20 - Arcturus

@traceystone 

 

The target is "yyyy-mm-01",  the first.  

yyyy comes from [a]
- comes from "-"

mm comes from padleft([b], 2, "0")

-01 comes from "-01"

 

 put it all together:

 

[a]+"-" + padleft([b],2,"0") + "-01"

 

If a or b are not strings, put a select in front of the formula tool and switch them.  

that's how I might solve the challenge. 

cheers,

 

 mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
traceystone
8 - Asteroid

I get nulls both ways. Says that YearMonth is not a valid date

traceystone_0-1649980679020.png

 

 

Qiu
21 - Polaris
21 - Polaris

@traceystone 

Can you check the date type of YearMonth, it should be String Type, rather then Date.

traceystone
8 - Asteroid

Well how bout that.. I missed that field when I added the formula. Thank you..

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels