Fiscal Year – Master Calender

Hi All,

Please find the Fiscal Year – Master Calender script.

Set vFM = 4 ;
LET vDateMin=num(makedate(2016,01,01));
LET vDateMax=floor(monthend(today()));
LET vDateToday = num(today());

CalenderTemp:

LOAD Distinct Date($(vDateMin) + RowNo() – 1,’DD-MMM-YYYY’) AS Date,
month(Date($(vDateMin) + RowNo() – 1,’DD-MMM-YYYY’)) AS Month,
year(Date($(vDateMin) + RowNo() – 1,’DD-MMM-YYYY’)) AS Year,
monthname(Date($(vDateMin) + RowNo() – 1,’DD-MMM-YYYY’)) AS Monthname,
Week(Date($(vDateMin) + RowNo() – 1,’DD-MMM-YYYY’)) AS Week
AutoGenerate 1 While $(vDateMin) + IterNo() – 1 <=$(vDateMax);

Calender:
Load *,Dual(fYear-1 &’/’& fYear, fYear) as FYear,  // Dual fiscal year
Dual(Month, fMonth)  as FMonth   // Dual fiscal month
;
load *,
Year + If(Month>=$(vFM), 1, 0) as fYear,  // Numeric fiscal year
Mod(Month-$(vFM), 12)+1  as fMonth   // Numeric fiscal month
Resident CalenderTemp;
drop table CalenderTemp;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.