DimensionElementDelete Function TM1: Syntax and Use

Here is how to simply delete a single element from a dimension in TM1. Note DimensionElementDelete permanently deletes the element from the TM1 dimension and all associated data from any cube the dimension is used in – so please be careful!

Syntax of DimensionElementDelete

The syntax is:

DimensionElementDelete ( dimension , element ) ; where

  • dimension – is the name of the dimension that you want to delete an element from
  • element – is the name of the element that you want to delete from the dimension

Example

DimensionElementDelete ( ‘Product’, ‘Shoes’);

This example deletes the element ‘Shoes’ from the ‘Product’ dimension.

Usage

Often we will use this function alongside the DIMIX and IF functions, so we end up with TI code that looks like this:

DimName = 'Product'

Element = 'Shoes'

IF ( DIMIX ( DimName , Element ) > 0 );

  DimensionElementDelete  ( DimName , Element ) ;

ENDIF;

This sets up the variables for the dimension name and element, then uses DIMIX to check if the element exists in the dimension and if it does, then it deletes it.

Notes

As stated above, this function will delete the element from the dimension and all data associated with the element in any cube where it is used.

If you are looking to delete an element from a parent, but leave the element still in the dimensions, just not as a child to the parent, please use DimensionElementComponentDelete.

This function is the opposite of DimensionElementInsert.

If you like this post, please spread the love…

About John

Managing Director of Infocube. We are a management accounting consultancy that specialises in Business Analytics.
This entry was posted in TI Functions and tagged DIMENSIONELEMENTCOMPONENTDELETE, DimensionElementDelete, DimensionElementInsert, dimix, IF. Bookmark the permalink.

One Response to "DimensionElementDelete Function TM1: Syntax and Use"

Log in to post a comment.