Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FY into Existing Master Calendar

Hi All,

I am trying to add Financial Years into my existing Master Calendar and having done some browsing and reading it appears there are a few methods but I could not see one with the right answer

I want to maintain the calendar below but also want to add in FY as an extra option is this a possibility?

Toby

/////////////////////////////
// QLIKVIEW MASTER CALENDAR//
/////////////////////////////


QuartersMap: 
MAPPING LOAD  
rowno() as Month, 
'Q' & Ceil (rowno()/3) as Quarter 
AUTOGENERATE (12); 
 
 
Temp: 
Load 
              min(CMDBDate) as minDate,     //  <<<<<  Change Name of Date Field Here
              max(CMDBDate) as maxDate       //  <<<<<  Change Name of Date Field Here
Resident ReportView; 
 
Let varMinDate = Num(Peek('minDate', 0, 'Temp')); 
Let varMaxDate = Num(Peek('maxDate', 0, 'Temp')); 
DROP Table Temp; 


TempCalendar: 
LOAD 
               $(varMinDate) + Iterno()-1 As Num, 
               Date($(varMinDate) + IterNo() - 1) as TempDate 
               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate); 
 
MasterCalendar: 
Load 
    TempDate AS CMDBDate,  //  <<<<<  Change Name of Date Field Here
    week(TempDate) As Week, 
    Year(TempDate) As Year, 
    Month(TempDate) As Month, 
    Day(TempDate) As Day, 
    WeekEnd(TempDate) as WeekEndDate,
    WeekStart(TempDate) as WeekStartDate,
    YeartoDate(TempDate)*-1 as CurYTDFlag, 
    YeartoDate(TempDate,-1)*-1 as LastYTDFlag, 
    inyear(TempDate, Monthstart($(varMaxDate)),-1) as RC12, 
    date(monthstart(TempDate), 'MMM-YYYY') as MonthYear, 
    ApplyMap('QuartersMap', month(TempDate), Null()) as Quarter, 
    Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear, 
    WeekDay(TempDate) as WeekDay 
   
Resident TempCalendar 
Order By TempDate ASC; 
Drop Table TempCalendar; 

1 Solution

Accepted Solutions
sasiparupudi1
Master III
Master III

you can use

ApplyMap('QuartersMap', Month(addmonths(addyears(TempDate,1),-3)), Null()) as FiscQuarter

hth

Sasi

View solution in original post

20 Replies
krishna20
Specialist II
Specialist II

Hi,

This Link surely helps you

Fiscal and Standard Calendar generation

Regards

Krishna

sasiparupudi1
Master III
Master III

use addmonths and addyears functions

example

addmonths(addyears(TempDate,1),-3) as FiscalDate

Month(addmonths(addyears(TempDate,1),-3)) as FiscalMonth,

Year(addmonths(addyears(TempDate,1),-3)) as FiscalYear

hth

Sasi

balasundaram
Creator II
Creator II

Hi,

Kindly find below script line

YearName(TempDate, 0, 4)) AS FiscalYear,

Not applicable
Author

Thank you so much Sasidhar!

How would I create fiscal QTRs? As the Calendar QTRs are created using a map...

sasiparupudi1
Master III
Master III

you can use

ApplyMap('QuartersMap', Month(addmonths(addyears(TempDate,1),-3)), Null()) as FiscQuarter

hth

Sasi

Not applicable
Author

Thank you very very much Sasidhar, you have made my day!

sasiparupudi1
Master III
Master III

You are Welcome. Glad that I could help

Sasi

Not applicable
Author

Hi Sasidhar,

In regards to the awesome help yesterday, how do I format the Financial year in the script to come out like 2015/2016 etc?

Toby

sasiparupudi1
Master III
Master III

try to add to your calendar

=Year(addmonths(addyears(TempDate,1),-3)) &'/' & Year(TempDate) as FiscalYearDisplay

hth

Sasi