Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I've picked up code for a Fiscal Calendar online.
I've tried to amend this code so that the calendar starts on a specific date.
So i want the calendar to start 01/04/2015. With the code below it starts in 1898??
Can anyone help and point out what I've done wrong? I am still a noob with Qlikview.
SET vFiscalYearStartMonth = 4;
Let vDate3 = 01/04/2015;
LET vStartDate = Num(YearStart(vDate3, 0));
LET vEndDate = Num(YearEnd(Today()));
FiscalCalendar:
LOAD
*,
Dual('Q' & Ceil(FiscalMonth/3), Ceil(FiscalMonth/3)) AS FiscalQuarter, // Fiscal Calendar Quarter
Dual(Text(Date(MonthEnd(Date), 'MMM')), FiscalMonth) AS FiscalMonthName; // Fiscal Calendar Month Name
LOAD
*,
Year(Date) AS Year, // Standard Calendar Year
Month(Date) AS Month, // Standard Calendar Month
Date(MonthEnd(Date), 'MMM') AS MonthName, // Standard Calendar Month Name
Dual('Q' & Ceil(Month(Date)/3), Ceil(Month(Date)/3)) AS Quarter, // Standard Calendar Quarter
Mod(Month(Date) - $(vFiscalYearStartMonth), 12)+1 AS FiscalMonth, // Fiscal Calendar Month
YearName(Date, 0, $(vFiscalYearStartMonth)) AS FiscalYear; // Fiscal Calendar Year
LOAD
Date($(vStartDate) + RangeSum(Peek('RowNum'), 1) - 1) AS Date,
RangeSum(Peek('RowNum'), 1) AS RowNum
AutoGenerate vEndDate - vStartDate + 1;
Change your variables to :
SET vDate3 = '01/04/2015';
LET vStartDate = Num(YearStart('$(vDate3)', 0));
The default variable you posted is evaluating "1 divide by 4 divide by 2015".
Using "set" enables the variable to be defined as text.
Thanks and regards,
Arthur Fong
Change your variables to :
SET vDate3 = '01/04/2015';
LET vStartDate = Num(YearStart('$(vDate3)', 0));
The default variable you posted is evaluating "1 divide by 4 divide by 2015".
Using "set" enables the variable to be defined as text.
Thanks and regards,
Arthur Fong