IBM Planning Analytics Tips & Tricks: Clearing All Data from a Cube
IBM Planning Analytics Tips & Tricks: Clearing All Data from a Cube

IBM Planning Analytics Tips & Tricks Series

Did you know there may be several situations during development where you may want to clear all of the data from a specific cube? This could be due to a new process to reload data, a second round of user testing, or a migration from DEV to PROD. 

There are a few approaches that can be used to clear data from a cube.  One approach is to create of a view which consists of the entire cube and using then performing a ViewZeroOut against that view. This can be done via the following script:

# Define cube name
strCube = ‘Finance’;

# Destroy any existing views and recreate a new one
IF (VIEWEXISTS (strCube, strView) <> 0);
VIEWDESTROY (strCube, strView);
ENDIF;
VIEWCREATE (strCube, strView);

# Perform Zero Out
VIEWZEROOUT (strCube, strView);

The benefit to this approach is that you now have flexibility to manipulate your view. You can have the view filter to specific elements within a dimension and/or set the view to ignore values such as rule-based values.

Another approach is to use the CubeClearData command. The CubeClearData command clears all data within a cube. Using this function is faster than writing a script at the expense of using an “all or nothing” approach. The same process defined above can be written using the following single line:

# Define cube name
strCube = ‘Finance’;

# Clear all data from the cube
CUBECLEARDATA (strCube);

Note that the CubeClearData command also clears any cells in the cube that are fed with feeders. If you want to restore the fed cells then you must either manually resave the rule that establishes the feeders or use the CubeProcessFeeders function.

There are multiple ways that can be used to clear data from a cube and you can define what approach is best for you.

IBM Planning Analytics, which TM1 is the engine for, is full of new features and functionality. Not sure where to start? Our team here at Revelwood can help. Contact us for more information at info@revelwood.com. And stay tuned for more Planning Analytics Tips & Tricks weekly in our Knowledge Center and in upcoming newsletters!

Learn more IBM Planning Analytics Tips & Tricks:

IBM Planning Analytics Tips & Tricks: When to Build Multiple Cubes

IBM Planning Analytics Tips & Tricks: Ensuring Cube Logging is Reset in TM1

IBM Planning Analytics Tips & Tricks: Making Default Views Dynamic with MDX

Need more guidance? Take a look at our IBM Planning Analytics Training services and our Customer Care Program.