I have been using attributes since I started working with TM1 and are often asked what are they and what are they used for.
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 are a number of types of TM1 attributes – Aliases, Descriptive and Format.
Aliases can be switched with the primary element identifier, while the rest cannot. Aliases thus, must be unique within themselves and the elements as well and 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