Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

Converting yyyymm text to date field.

$
0
0

I am bringing in a column in my data that is yyyymm text and creating two additional columns for yyyy and mm in order to join to other tables.

 

Example of Table:

YYYYMM (text)YYYY (text)MM (text)
201604201604

 

I would like to create a date column based on this information. In my last step, I was going to leverage the LastDayOfMonth(<date>) calculation to align the day with the last day of each month.

 

I have tried three formulas:

1. MakeDate(yyyy,mm,28):

          Error Message: Function MakeDate expects parameter 1 of type 'integer', but receives 'string'. Try using the expected parameter type

2. MakeDate(ToNumber(yyyy),ToNumber(mm),28):

          Error Message: Function MakeDate expects parameter 1 of type 'integer', but receives 'double'. Try using the expected parameter type

3. ToDate(Concatenate(YYYYMM,28),"yyyy/mm/dd")

          The column populates, but it's blank.

 

The third try looks similar to this thread, but their answer did not work for me: Function ToDate uses an invalid format 'yyyyMMdd' for parameter format. Try rewriting the formula.


Viewing all articles
Browse latest Browse all 3523

Trending Articles