Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I am bringing in a table with FiscalYearMonth field. it is showing 2 years- 2013 and 2014 and I want to bring in only 2014.
The set up of the field is YYYYMM but I want to split it to just show YYYY as FiscalYear and MM as Month.
I used the mid function on the field in the load scipt
Mid(FiscalYearMonth,1,4) as FiscalYear
Mid(FiscalYearMonth,4,2) as Month
I put where at the end of my from statement (Where FiscalYear=2014) but it did not recognize the field as I am making it in the table. Makes sense. Do you know how to limit my data input to 2014?
Use this as the where clause:
WHERE Mid(FiscalYearMonth,1,4) = '2014';
You can try like this (in the preceding load):
LOAD *
Where FiscalYear = 2014;
LOAD AllOtherFields,
Mid(FiscalYearMonth,1,4) as FiscalYear
Mid(FiscalYearMonth,4,2) as Month
FROM Source;
Or maybe
LOAD OtherField,
FiscalYearMonth,
Mid(FiscalYearMonth,1,4) as FiscalYear,
Mid(FiscalYearMonth,5,2) as Month //shouldn't it be 5,2?
FROM YourTableSource
WHERE FiscalYearMonth LIKE '2016*';