Dimension usage

Example files with this article:
  • Dimension usage
  • Introduction

    In the larger TM1 applications (say, >15 cubes, >50 dimensions), you do not see immediately which dimensions are used in a cube, and which ones are not. Let us look at a small process to add an attribute to the }Dimensions dimension, having a 0 or a 1. 0 means that the dimension is not used in an application cube, while a 1 means that the dimension is used at least once in an application cube.

    A process-based approach

    Here are the steps for the TI process. First create a new process. As the Datasource Type, choose TM1 > Dimension Subset. In the Data Source Name, navigate towards the subset All on the dimension }Cubes. To be able to see this control dimension, in the menu bar you should take View > Display Control Objects. In the Variables tab of the process, call the (only) variable vCube and set Contents to Other.

    To mimize your work, right-click the file above and Save it. Here is the code in the Prolog tab:

    # Wim Gielis # https://www.wimgielis.com
    ##### # TI code to track the usage of the dimensions # in application cubes # 24/12/09 #####
    # Recreate the attribute to store the results AttrDelete('}Dimensions','Dimension usage'); AttrInsert('}Dimensions','','Dimension usage','N');

    Here is the code in the Data tab:

    # exclude control cubes
         # track the number of dimensions for this cube
         # loop over the dimensions in this cube
              AttrPutN(1,'}Dimensions',Tabdim(vCube,iDim),'Dimension usage');


    By adding an AttrN function in front of the AttrPutN, you could count the number of times the dimension was used. With the information on this page, you could easily go out and delete unused dimensions. Either add a bit of code to this process, either delete the dimensions manually (in a Subset Editor, filter on attribute Dimension usage being 0).


    Section contents

    About Wim

    Wim Gielis is a Business Intelligence consultant and Excel expert

    Other links