Create Year-Quarter-Month Hierarchy
Posted: Thu Feb 09, 2012 11:51 pm
I found a TI process in our system that creates our time dimension, but it rolls all months to year, rather than rolls Jan-mar to Q1 which is our existing structure. I tried to modify it based on my understanding of the code, I have difficulty to understand why Jan-Mar was rolled to both Q1-Q2 and Year though I already defined in where components should be added to strquarter1-2, which is 2015Q1 &2015Q2. I also tried to import cvs file (we have a TI code to export dimension to cvs file), I just do find/replace to 2015, save it. I attach screen prints of the process. Error message indicated that "can not open the cvs. file", weird, I saw data in preview.
I need your helps to resolve both TI process and traditional way of importing data via text data source. All replies I got from this forum are great. As a new TM1 members, thanks again for your time.
I need your helps to resolve both TI process and traditional way of importing data via text data source. All replies I got from this forum are great. As a new TM1 members, thanks again for your time.
Code: Select all
# create year>4quarters>month tree to bpmTime
#****Begin: Generated Statements***
#****End: Generated Statements****
strDim = 'bpmTime';
#===================================
# >>> Create Roots (if needed)
#===================================
strRoot1 = 'Years';
strRoot2 = 'YTD';
strRoot3 = 'QTD';
numCtr = 1;
numCtrMax = 3;
WHILE (numCtr <= numCtrMax);
strVal = NUMBERTOSTRING (numCtr);
strElem = EXPAND ('%' | 'strRoot' | strVal | '%');
IF (DIMIX (strDim, strElem) = 0);
DIMENSIONELEMENTINSERT (strDim, '', strElem, 'C');
ENDIF;
numCtr = numCtr + 1;
END;
#===================================
# >>> Create Parents
#===================================
strElem = parYear;
IF (DIMIX (strDim, strElem) = 0);
DIMENSIONELEMENTINSERT (strDim, '', strElem, 'C');
ENDIF;
DIMENSIONELEMENTCOMPONENTADD (strDim, strRoot1, strElem, 1);
#Create Q1-Q4 Consolidation
strquarter1 = parYear | 'Q1';
strquarter2 = parYear | 'Q2';
strquarter3 = parYear | 'Q3';
strquarter4 = parYear | 'Q4';
numCtr = 1;
numCtrMax = 4;
WHILE (numCtr <= numCtrMax);
strVal = NUMBERTOSTRING (numCtr);
strElem = EXPAND ('%' | 'strquarter' | strVal | '%');
#Create Parents
IF (DIMIX (strDim, strElem) = 0);
DIMENSIONELEMENTINSERT (strDim, '', strElem, 'C');
ENDIF;
strParent = parYear;
DIMENSIONELEMENTCOMPONENTADD (strDim, strParent, strElem, 1);
numCtr = numCtr + 1;
END;
#===================================
# >>> Create Base Level Elements
#===================================
str0 = 'Opening Balance ' | parYear;
str1 = 'Jan-' | parYear;
str2 = 'Feb-' | parYear;
str3 = 'Mar-' | parYear;
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str0,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str1,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str2,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter1, str3,1);
str4 = 'Apr-' | parYear;
str5 = 'May-' | parYear;
str6 = 'Jun-' | parYear;
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter2, str4,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter2, str5,1);
DIMENSIONELEMENTCOMPONENTADD (strDim, strquarter2, str6,1);