Nov 2, 2017

Find unused dimensions

Ever wondered which of the dimensions in your TM1 Model are not used in cubes?

TM1py can help to answer this questions with 8 Lines of code!

If you have previously downloaded all samples folder, the script “find unused dimensions.py” is located in the Other folder:

If you want to only download this script, you can find the code on github.

1. Check connection with TM1

Before running the script you should make sure that the connection with your TM1 instance is working:

2. Update the script

Open the python script with a text editor and update the TM1 connection information (address, port, user, password, ssl):

3. Run the script

Open a command line from where the script is located and then type:

  • python “find unused dimensions.py”

By default it is going to print the list of all dimensions in the command line.

4. Print the list of dimensions into a file

To print this list of dimension in a file you can replace the following code:

    print(unused_dimensions)

with

with open('output.csv','w') as file:    for dim in unused_dimensions:        print(dim, file=file)

Your code should look like this:

Save the script and if you run the same command line again:

The script will create the file in the same location where the script is located:

Open the file and you will see the list of all dimensions:

Be careful before deleting a dimension

This script will give you the list of all dimensions which are not used in a cube. But unused in a cube does not mean that the dimension is not used by something else. For example the dimension could be used in a TM1 process or TM1 rule.

To find all unused dimensions using a TM1 process, you can find the steps in this IBM guide:

Related content

Loading related content