Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
karensmith
Contributor II
Contributor II

Calendar Object Based on Fiscal Calendar

How do you make a calendar object based on Fiscal Calendar(April- March)?

3 Replies
johnw
Champion III
Champion III

I'm not sure quite what you're asking. When I make calendars, I'm just tying dates in to other "formats" of the date. For a calendar in that sense, something like this (untested):

[Fiscal Calendar]:
LOAD date(date#(20061231,'YYYYMMDD')+recno(),'MM/DD/YY') as "Date"
AUTOGENERATE today()-date#(20061231,'YYYYMMDD')
;
LEFT JOIN ([Fiscal Calendar])
LOAD
"Date"
,date(monthstart(Date),'MMM YY') as "Month"
,date(yearstart(Date),'YYYY') as "Calendar Year"
,date(yearstart(Date,0,4),'YYYY') as "Fiscal Year"
RESIDENT [Fiscal Calendar])
;


karensmith
Contributor II
Contributor II
Author

John,

Thanks for your assistance. This code worked great. It created calendar up to current date. One more question- How would create calendar days greater than current date.

johnw
Champion III
Champion III


KarenSmith wrote:Thanks for your assistance. This code worked great. It created calendar up to current date. One more question- How would create calendar days greater than current date.


Just change this part of the code:

AUTOGENERATE today()-date#(20061231,'YYYYMMDD')

The AUTOGENERATE just generates a certain number of occurrences. Here, I calculate the number of occurrences such that it will generate everything between January 1, 2007 and today(). If you want a calendar through the end of the current year, for instance, you could do this:

AUTOGENERATE yearend(today())-date#(20061231,'YYYYMMDD')