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: 
Anonymous
Not applicable

Create a MasterCalendar with Month and Year

Hi,

I've a Startdate (2013-10-01) and Enddate (2015-01-01). On Load my calendar should be generate a Startdate like Oct 13 and an Enddate like Sep 15.

Regards Stefan

Nachricht geändert durch Stefan Fischer

14 Replies
Gysbert_Wassenaar

LET vStart = num(date#('2013-10-01','YYYY-MM-DD'));

LET vEnd =  num(date#('2015-09-01','YYYY-MM-DD'));

Calendar:

LOAD Month, Year(Month) as Year;

LOAD

    AddMonths($(vStart), iterno() -1) as Month

AUTOGENERATE1)

WHILEAddMonths($(vStart), iterno() -1) <= $(vEnd);

Or perhaps you want this:

LET vStart = num(date#('2013-10-01','YYYY-MM-DD'));

LET vEnd =  num(date#('2015-09-01','YYYY-MM-DD'));

Calendar:

LOAD $(vStart) as StartDate, $(vEnd) as EndDate

AUTOGENERATE(1);


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thats fine, but how could it ended on Sep 15?

Gysbert_Wassenaar

Sep 15 of which year?


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Year of vEnd

Gysbert_Wassenaar

Change vEnd:

LET vStart = num(date#('2013-10-01','YYYY-MM-DD')); 

LET vEnd =  num(date#('2015-09-15','YYYY-MM-DD')); 

 

Calendar: 

LOAD $(vStart) as StartDate, $(vEnd) as EndDate 

AUTOGENERATE(1);


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

That's right, but for 2015-09-01 there is not data for load. I've problems to solve my question. Can you help pls.

Gysbert_Wassenaar

I'm afraid I don't have any idea anymore what you want. Can you please explain what you want in more detail?


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

I've add one sample. If i extract year in 2015-01-01, vEnd is dependent of last date. It is possible?

LET vEnd =  num(date#(year(month)&'-09-15','YYYY-MM-DD'));

Gysbert_Wassenaar

LET vEnd =  num(date#(year(month)&'-09-15','YYYY-MM-DD'));

The above gives no result because year(month) can't be calculated because 'month' is undefined. You would have to create a variable named month first.


talk is cheap, supply exceeds demand