Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
we have to follow calendar April-March and We have a field 'OrderDate', Based on this field how can i derive the year?
for eg:
For the period April-01-2014 to March-31-2015 we need to show year as 2014.
It will be worth calculating some new fiscal period fields in your load script.
Here are a few examples that take a field called 'Date' and calculate a FiscalYear,FiscalMonthNumber,FiscalYearMonth etc...
LOAD
Date,
if( Month(Date)>=4, Year(Date), Year(Date) -1) as FiscalYear,
if( Month(Date)>=4, Month(Date)-3,Month(Date)+9) as FiscalMonthNumber,
if( Month(Date)>=4, Year(Date), Year(Date) -1) & ' - ' & if( Month(Date)>=4, Month(Date)-3,Month(Date)+9) as FiscalYearMonth,
Year(Date) & ' - ' & Month(Date) as CalendarYearMonth
FROM
<source>;
here is the sample app for you to look at .
It will be worth calculating some new fiscal period fields in your load script.
Here are a few examples that take a field called 'Date' and calculate a FiscalYear,FiscalMonthNumber,FiscalYearMonth etc...
LOAD
Date,
if( Month(Date)>=4, Year(Date), Year(Date) -1) as FiscalYear,
if( Month(Date)>=4, Month(Date)-3,Month(Date)+9) as FiscalMonthNumber,
if( Month(Date)>=4, Year(Date), Year(Date) -1) & ' - ' & if( Month(Date)>=4, Month(Date)-3,Month(Date)+9) as FiscalYearMonth,
Year(Date) & ' - ' & Month(Date) as CalendarYearMonth
FROM
<source>;
here is the sample app for you to look at .
Thanks Jonathan,
It's Working