build new dimension using subset of a dimension using TI pro

Post Reply
sunitha
Posts: 8
Joined: Wed Apr 14, 2010 10:45 pm
OLAP Product: tm1
Version: 9.4
Excel Version: 2003

build new dimension using subset of a dimension using TI pro

Post by sunitha »

Hi,

I'm building the dimension,using existing dimension model,where the existing dimension has the different costcentres for ex.hr,IT,Fin under each costcentre we have different levels.i want to build the different individual dimensions like HR,FIN,IT dimensions using existing dimension model as input in TI Process.

i'm trying to acheive this by creating a subset with level0 elements and try to build the different dimensions by using the ELPAR functions in metadata tab.But i'm not able to build the dimension with complete hierarchy.

It is on high priority to build the dimension.

can any on please guide/help me how to build this..

Thanks in advance for your assistance.

regards,
Sunitha.
sunitha
Posts: 8
Joined: Wed Apr 14, 2010 10:45 pm
OLAP Product: tm1
Version: 9.4
Excel Version: 2003

building new dimension using subse of dim in TI processes

Post by sunitha »

Hi,

I'm building the dimension,using existing dimension model,where the existing dimension has the different costcentres for ex.hr,IT,Fin under each costcentre we have different levels.i want to build the different individual dimensions using the existing dimension modelm as input.

i tried using subset and elpar functions but i'm not able to build it.

can you please guide me how to build this..

Thanks in advance for your assistance..

regards,
Sunitha.

{Admin Note: This topic has been merged into an almost identical one by the same poster. Please keep one topic to one thread. Thanks.}
Wim Gielis
MVP
Posts: 3230
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: build new dimension using subset of a dimension using TI

Post by Wim Gielis »

Hello,

What is the logic to choose the elements HR, FIN, IT, ...

- do they contain an attribute?
- is it always level 4 or 3 or any other number (but always the same)?
- or these the direct children of some other consolidation?
- are these all elements in the dimension with parents?
- ...

Without a clear definition of these items, you're process will not work.

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
sunitha
Posts: 8
Joined: Wed Apr 14, 2010 10:45 pm
OLAP Product: tm1
Version: 9.4
Excel Version: 2003

Re: build new dimension using subset of a dimension using TI

Post by sunitha »

Hi Wim,

there are no attributes in the base dimension.
we have level 4 hirearchy in the base dimension
each department in the dimension has its direct children with level3 hierarchy.

for reference i'm attaching snap shot of the base dim with different depts.what we need to do was, we need to build individual dimensions like hr,fin etc with the help os base dim

regards,
sunitha
Attachments
base dim.doc
(121 KiB) Downloaded 605 times
sunitha
Posts: 8
Joined: Wed Apr 14, 2010 10:45 pm
OLAP Product: tm1
Version: 9.4
Excel Version: 2003

Re: build new dimension using subset of a dimension using TI

Post by sunitha »

attached doc is the sample base dimension which has three departments HR, Fin, Trans.It has its own children, without any attributes. Now the requirement is we need to build the individual dimensions like HR, FIN, Trans as different dimensions by using the base dimension with TI processes.

Can any one help me how to build this?
Attachments
base dim.doc
(85 KiB) Downloaded 653 times
Wim Gielis
MVP
Posts: 3230
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: build new dimension using subset of a dimension using TI

Post by Wim Gielis »

Hello

Here's fully developed TI code. Copy paste the code into the Advanced > Prolog tab of a TI process, use 'None' as the Data source.

Code: Select all

# Wim Gielis
# http://www.wimgielis.be


# create the dimension
i=1;

WHILE(i<=ELCOMPN('ecc_planningprocess','totalunits'));

     vComp=ELCOMP('ecc_planningprocess','totalunits',i);

     IF(DIMENSIONEXISTS(vComp)=1);
          DIMENSIONDELETEALLELEMENTS(vComp);
     ELSE;
          DIMENSIONCREATE(vComp);
     ENDIF;

     SUBSETDESTROY('ecc_planningprocess','mysubset');
     SUBSETCREATEBYMDX('mysubset', ' {TM1FILTERBYLEVEL({DESCENDANTS(ecc_planningprocess.[' | vComp | ']) }, 0)}' );

     # loop through the elements of the subset

      j=1;

     WHILE(j<=SUBSETGETSIZE('ecc_planningprocess','mysubset'));

          vElem=SUBSETGETELEMENTNAME('ecc_planningprocess','mysubset',j);
          vType=DTYPE('ecc_planningprocess',vElem);

          DIMENSIONELEMENTINSERT(vComp,'',vElem,vType);

          # PARENTS (loop through them)
          k=1;
          WHILE(k<=ELPARN('ecc_planningprocess',vElem));
               vParent=ELPAR('ecc_planningprocess',vElem,k);

               IF(vParent@<>vComp);
                    vWeight=ELWEIGHT('ecc_planningprocess',vParent,vElem);
                    DIMENSIONELEMENTINSERT(vComp,'',vParent,'C');
                    DIMENSIONELEMENTCOMPONENTADD(vComp,vParent,vElem,vWeight);
                     k=k+1;
                ENDIF;
          END;

          j=j+1;

     END;

     i=i+1;

END;

SUBSETDESTROY('ecc_planningprocess','mysubset');
That should do it.

Use variables to reduce the amount of hardcoded names.

Wim
Best regards,

Wim Gielis

IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
sunitha
Posts: 8
Joined: Wed Apr 14, 2010 10:45 pm
OLAP Product: tm1
Version: 9.4
Excel Version: 2003

Re: build new dimension using subset of a dimension using TI

Post by sunitha »

Thank you wim
for your interest it helped me in creating the dimensions.
sivan307
Posts: 28
Joined: Wed Sep 01, 2010 2:15 pm
OLAP Product: TM1
Version: 9.5.1
Excel Version: 2007

Re: build new dimension using subset of a dimension using TI

Post by sivan307 »

Thanks Wim. I am able to use your code to do a similar task today. Thanks for the code. Thanks Sunitha :-)
Armonds
Posts: 5
Joined: Thu Mar 28, 2013 8:46 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010

Re: build new dimension using subset of a dimension using TI

Post by Armonds »

Great example, it helped me a lot.
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: build new dimension using subset of a dimension using TI

Post by BariAbdul »

Hi All,I have created dimension 'ecc_planningprocess' and tried below Wim Gielis code:

Code: Select all

    # Wim Gielis
    # http://www.wimgielis.be


    # create the dimension
    i=1;

    WHILE(i<=ELCOMPN('ecc_planningprocess','totalunits'));

         vComp=ELCOMP('ecc_planningprocess','totalunits',i);

         IF(DIMENSIONEXISTS(vComp)=1);
              DIMENSIONDELETEALLELEMENTS(vComp);
         ELSE;
              DIMENSIONCREATE(vComp);
         ENDIF;

         SUBSETDESTROY('ecc_planningprocess','mysubset');
         SUBSETCREATEBYMDX('mysubset', ' {TM1FILTERBYLEVEL({DESCENDANTS(ecc_planningprocess.[' | vComp | ']) }, 0)}' );

         # loop through the elements of the subset

          j=1;

         WHILE(j<=SUBSETGETSIZE('ecc_planningprocess','mysubset'));

              vElem=SUBSETGETELEMENTNAME('ecc_planningprocess','mysubset',j);
              vType=DTYPE('ecc_planningprocess',vElem);

              DIMENSIONELEMENTINSERT(vComp,'',vElem,vType);

              # PARENTS (loop through them)
              k=1;
              WHILE(k<=ELPARN('ecc_planningprocess',vElem));
                   vParent=ELPAR('ecc_planningprocess',vElem,k);

                   IF(vParent@<>vComp);
                        vWeight=ELWEIGHT('ecc_planningprocess',vParent,vElem);
                        DIMENSIONELEMENTINSERT(vComp,'',vParent,'C');
                        DIMENSIONELEMENTCOMPONENTADD(vComp,vParent,vElem,vWeight);
                         k=k+1;
                    ENDIF;
              END;

              j=j+1;

         END;

         i=i+1;

    END;

    SUBSETDESTROY('ecc_planningprocess','mysubset');
But when I run the process in TM1 perspectives,It doesn't show any error but the process doesn't initialize and keep running on and hangs up.Any ideas please.Thanks
"You Never Fail Until You Stop Trying......"
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: build new dimension using subset of a dimension using TI

Post by BariAbdul »

Hi Wim,I have tried again ,It is giving me error dimension ecc_planningprocess could not be find ,when I commented out

Code: Select all

SUBSETDESTROY('ecc_planningprocess','mysubset');
the process runs successfully but I do not see any 'ecc_planningprocess' dimension being created.Please help me on this.Thanks
"You Never Fail Until You Stop Trying......"
declanr
MVP
Posts: 1828
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: build new dimension using subset of a dimension using TI

Post by declanr »

BariAbdul,

Please post the entire contents of your TI.
Declan Rodger
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: build new dimension using subset of a dimension using TI

Post by BariAbdul »

Thanks a lot declanr,The entire Code is below, as Wim suggested I have choose none as the data source and pasted whole content below

Code: Select all

# Wim Gielis
# http://www.wimgielis.be


# create the dimension
i=1;

WHILE(i<=ELCOMPN('ecc_planningprocess','totalunits'));

     vComp=ELCOMP('ecc_planningprocess','totalunits',i);

     IF(DIMENSIONEXISTS(vComp)=1);
          DIMENSIONDELETEALLELEMENTS(vComp);
     ELSE;
          DIMENSIONCREATE(vComp);
     ENDIF;

     SUBSETDESTROY('ecc_planningprocess','mysubset');
     SUBSETCREATEBYMDX('mysubset', ' {TM1FILTERBYLEVEL({DESCENDANTS(ecc_planningprocess.[' | vComp | ']) }, 0)}' );

     # loop through the elements of the subset

      j=1;

     WHILE(j<=SUBSETGETSIZE('ecc_planningprocess','mysubset'));

          vElem=SUBSETGETELEMENTNAME('ecc_planningprocess','mysubset',j);
          vType=DTYPE('ecc_planningprocess',vElem);

          DIMENSIONELEMENTINSERT(vComp,'',vElem,vType);

          # PARENTS (loop through them)
          k=1;
          WHILE(k<=ELPARN('ecc_planningprocess',vElem));
               vParent=ELPAR('ecc_planningprocess',vElem,k);

               IF(vParent@<>vComp);
                    vWeight=ELWEIGHT('ecc_planningprocess',vParent,vElem);
                    DIMENSIONELEMENTINSERT(vComp,'',vParent,'C');
                    DIMENSIONELEMENTCOMPONENTADD(vComp,vParent,vElem,vWeight);
                     k=k+1;
                ENDIF;
          END;

          j=j+1;

     END;

     i=i+1;

END;

SUBSETDESTROY('ecc_planningprocess','mysubset');
"You Never Fail Until You Stop Trying......"
declanr
MVP
Posts: 1828
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: build new dimension using subset of a dimension using TI

Post by declanr »

You say that you see no "ecc_planningprocess" dimension being created but the first thing your TI tries to do is read what is already in that dimension. If it doesn't exist when you start it won't do a great deal.

Perhaps I am missing something but lets go back to basics, what are you trying to do? What already exists and what are you trying to create from it?
Declan Rodger
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: build new dimension using subset of a dimension using TI

Post by BariAbdul »

Thanks a lot Declanr,Actually I am trying to create dimension similar to OP sunitha has posted.When I find 'No Dimension Found Error',I did create empty dimension using DimensionCreate(ecc_planningprocess) but nothing being created.Now I would create dimension similar to attachement the OP posted and see whether it would worked out.Appreciate your help.
"You Never Fail Until You Stop Trying......"
declanr
MVP
Posts: 1828
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: build new dimension using subset of a dimension using TI

Post by declanr »

The code you are using has its first step of looping an elements children... if that element doesn't exist nothing in the loop will be done.
Declan Rodger
Post Reply