1 Reply Latest reply: Feb 8, 2017 9:09 AM by Marcus Sommer RSS

    Autogenerate Quarters and Months

    Kashif Feroz

      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