Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, please can someone tell me how to make a year month column
I am bringing in a field from excel called Anticipated Launch date.
An example of a date being brought in is Apr-15
I want to create a new column with year month in it so would want the above to show as
2015-4
Please can someone help with this issue.
Thank you
Kind Regards
Unfortunately this is still not working
Emma
What kind of not working ?
Hi
It seems you have two date formats in your data source. Use the Alt() statement to parse the date in two or more formats, like this:
Date(Alt(Date#([Launch Date],'MMM-YY'), Date#([Launch Date],'YYYY-M')),'YYYY-M') as YearMonth
The first Date# will match the MMM-YY fields, but the YYYY-M fields in your input will not match, so then the Alt() will try the second Date#. The Date() statement will ensure all the resulting dates display as YYYY-M.
HTH
Jonathan
either:
LOAD
Date(Date#(yearmonth ,'YYYY-M'),'YYYY-M') as yearmonth;
SQL SELECT
convert(varchar,year([PstngDate])) + '-' + convert(varchar,month([PstngDate])) as yearmonth
FROM yourdatabase;
or:
LOAD
Date(PstngDate,'YYYY-M') as yearmonth;
SQL SELECT
PstngDate
FROM yourdatabase;