Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ankit1988
Contributor III
Contributor III

Fiscal Calendar

Hi.

I have a dataset have Date Field from this date field i have to create master calendar script. Now i have to add in this master calendar script Fiscal year, Fiscal Month, fiscal Month Number. 

can any one suggest how to add this 

 

thanks

 

Labels (1)
3 Replies
Hania
Creator
Creator

hello , 

I have created Fiscal year Master calendar on my sample data ,

you can try bellow script on your data.

/* ---------------------------------------------------------------------------*/
SET vFiscalYearStartMonth = 4;

min_max:
Load

Min(Delivery_Date) as minDate,
Max(Delivery_Date) as maxDate

Resident SALESDETAILS;

Let vMinDate = Peek('minDate',0,'min_max');

Let vMaxDate = Peek('maxDate',0,'min_max');

drop table min_max;


Fiscal_Master_Calendar:

/* ---------------------------------------------------------------------------*/
// Create Fiscal Quarter & Month Name

Load
*,
dual('Q' & Ceil(FiscalMonth/3), Ceil(FiscalMonth/3)) as FiscalQuarter,
Dual(text(MonthName(Delivery_Date)), FiscalMonth) as FiscalMonthName,

;

/* ---------------------------------------------------------------------------*/
// Create Fiscal Month & Fiscal Year

Load

*,
mod(Month(Delivery_Date) - $(vFiscalYearStartMonth), 12) + 1 as FiscalMonth,
YearName(Delivery_Date, 0, $(vFiscalYearStartMonth)) as FiscalYear,

;

/* ---------------------------------------------------------------------------*/
// Create Fiscal Calendar Records

Load

Date($(vMinDate) + IterNo() - 1) as Delivery_Date

AutoGenerate 1

While $(vMinDate) + IterNo() - 1 <= $(vMaxDate);

as per your needed requirement you can create Month , Year and so on. 

Hope this helps you!

 

vikasmahajan

Hi,

Please refer this link

https://community.qlik.com/t5/Member-Articles/SIMPLE-MASTER-CALENDER/ta-p/1484974

 

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Prem0212
Creator
Creator

You can use the below script  for the Master calendar

Year("Ship Date") as Year,
QuarterName("Ship Date") as Quarter,
Month("Ship Date") as Month,
Week("Ship Date") as WeekNo,
WeekDay("Ship Date") as WeekDay,
Day("Ship Date") as Day,
DayNumberOfYear("Ship Date") as DayNoYear,