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: 
kash04kk
Contributor II
Contributor II

Autogenerate Quarters and Months

Hi All,

I'm using the following script to make quarters:

set vStartDate = date(date#('31-Dec-2009','DD-MMM-YYYY'));

set vEndDate = date(date#('31-Dec-2015','DD-MMM-YYYY'));

set vNoQuarters = ($(vEndDate) - $(vStartDate))/(365/4) + 1;

Valuation_Quarter:

Load

  addmonths($(vStartDate),(iterno()-1)*3) as Valuation_Quarter

autogenerate 1  while iterno()<= $(vNoQuarters);

This works. I want to make months in a similar manner like this:

set vStartDate = date(date#('31-Dec-2009','DD-MMM-YYYY'));

set vEndDate = date(date#('31-Dec-2015','DD-MMM-YYYY'));

set vNoQuarters = ($(vEndDate) - $(vStartDate))/(365/4) + 1;

set vNoMonths = year($(vEndDate))*12 - year($(vStartDate))*12 + month($(vEndDate)) - month($(vStartDate)) + 1;

Valuation_Quarter:

Load

  addmonths($(vStartDate),(iterno()-1)*3) as Valuation_Quarter

autogenerate 1  while iterno()<= $(vNoQuarters);

Valuation_Months:

Load

  addmonths($(vStartDate),(iterno()-1)*1) as Valuation_Months

autogenerate 1  while iterno()<= $(vNoMonths);

By using this, I'm getting "Out of Object Memory" error. Any solution for this? Or if you can suggest any easier alternative to autogenerate quarters and months, please do.

Thanks and Regards,

Kashif

1 Reply
marcus_sommer

I think it would be easier to create month and quarters within a master-calendar. Here you will find many informations about How to use - Master-Calendar and Date-Values.

- Marcus