Attributes in TM1
Attributes are one of the core components of TM1. They allow you to describe and categorise elements, use alternate descriptions or IDs and to build virtual hierarchies and dimensions.
What are Attributes in TM1?
TM1 Attributes are a way of adding relevant information to elements in dimensions. For example, an attribute of a date element might be the day of the week, or the number of business days passed in a month. Or for a product element where the primary is a product code, an attribute might be the product name or a concatenation of product code and name. In essence, we use attributes to describe the elements themselves.
There different types of TM1 attributes. There are: Aliases, Descriptive and Format.
Aliases can be switched with the primary element identifier, while the rest cannot. Therefore aliases must be unique within themselves, and the elements can then be used for loading data if required.
Descriptive attributes can be used for adding any information about an element that might be useful. This could include such things as a product or customer type, information about a product, account, customer or an employee.
Format attributes are used to define how an element is to be displayed in the cube viewer.
Example of the Use of Attributes in TM1
Assume you sell fish tanks and have each product defined as a stock keeping unit in your accounting system. You then might have a product dimension where the element is the sku itself, an attribute set up with a concatenation of the sku and name (because that will be unique), then a descriptive attribute with the name (because it may not always be unique) and then descriptive attributes for tank length (say 100), width, height and volume. You might then create some additional attributes say for the tank type – glass or plastic, for the supplier (if there is a single supplier per sku) or usage – is it a tropical, gold-fish or marine tank.
Importantly you could then use those attributes for subsequent building of hierarchies, for aggregation or for mapping data to other cubes.
Defining Attributes in TM1
Attributes in TM1 can be defined both manually and through Turbo Integrator processes.
To define an attribute manually, simply right-click on the dimension in Architect and selecting Define Attribute. Then once in the attribute editor, you can add new attributes or define the attributes for each element.
If you have a large number of elements in your dimension, do not use the right-click method to open the attribute editor. Turn on Control Objects and look for the control cube for the dimension, then open that and make your changes there.
Finally, you can also define TM1 Attributes through automated process within TI scripts. Here you can:
- Add a new attribute
- AttrPutS, define a string attribute for an element
- AttrPutN, define a numeric attribute for an element
- Delete an attribute
Virtual Dimensions, or hierarchies, are new to TM1 with the release of Planning Analytics. They are built based on attributes and are an extremely flexible way to add new analytic capability to your existing TM1 models. Please see this post for a detailed explanation on what they are, how they work and how to create virtual dimensions.