Page 1 of 1

TI process to create rolling QTD hierarchy

Posted: Wed May 14, 2014 3:07 am
by StevieBenStevie
Anybody ever done a rolling QTD hierarchy? I need TI to automate the process of building a rolling Quarter-to-Date hierarchy. I have been successful in YTD and MTD, but those are both a little flatter and simpler. The process needs to look at the Current Date, and figure out that May-13-2014 (vRenameToday) belongs to Q2 and add all the days belonging to Q2 - which basically extends back to April 1st...giving my hiearchy 'Current-QTD' all the days in April 2014 and all the days up to May 13th...but no parents. Easy peasy? This below is the metadata process I have built for the MTD hierarchy - but it eludes me how to transform this for Quarters. I do have an attribute attached to each Day that proclaims "Quarter_Caption".

#****Begin: Generated Statements***
vRenameToday=subst(vToday,1,10);
vAddTop='Current-MTD';
#****End: Generated Statements****

Totaldays=SubsetGetSize('Time','n level');

#Delete all element under Current MTD
a=1;
While(a<=TotalDays);
DayToRemove=SubsetGetElementName('TIme','n level',a);
IF(ELISANC('Time','Current-MTD',DayToRemove)=1);
DimensionElementComponentDelete('Time', 'Current-MTD',DayToRemove);
ENDIF;

a=a+1;
END;

#RECReate the Current MTD consolidation

DaysInmonth=NUMBR(subst(vRenameToday,9,2));

DayCount=1;

While(DayCount<=DaysInMonth);
IF(DayCount<10);
DayToAdd=subst(vRenameToday,1,8)|'0'|STR(Daycount,1,0);
ENDIF;
IF(DayCount>=10);
DayToAdd=subst(vRenameToday,1,8)|STR(Daycount,2,0);
ENDIF;

DIMENSIONELEMENTINSERT('Time','',DayToAdd,'n');
DIMENSIONELEMENTINSERT('Time','',vAddTop,'c');
DIMENSIONELEMENTCOMPONENTADD('Time',vAddTop,DayToAdd,1.000000);

DayCount=daycount+1;
END;