Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
you can use
ApplyMap('QuartersMap', Month(addmonths(addyears(TempDate,1),-3)), Null()) as FiscQuarter
hth
Sasi
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
Hi,
Kindly find below script line
YearName(TempDate, 0, 4)) AS FiscalYear,
Thank you so much Sasidhar!
How would I create fiscal QTRs? As the Calendar QTRs are created using a map...
you can use
ApplyMap('QuartersMap', Month(addmonths(addyears(TempDate,1),-3)), Null()) as FiscQuarter
hth
Sasi
Thank you very very much Sasidhar, you have made my day!
You are Welcome. Glad that I could help
Sasi
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
try to add to your calendar
=Year(addmonths(addyears(TempDate,1),-3)) &'/' & Year(TempDate) as FiscalYearDisplay
hth
Sasi