MicroStrategy ONE
Derived Attributes: Creating Attributes Based on Existing Objects
You can create and add derived attributes to a dashboard, based on dataset objects that already included in the dashboard. You can combine the geographical region attribute with the state attribute to produce a result like Chicago, Illinois by using the Concatenation function. A derived attribute works the same as any other attribute. You can add it to a visualization, drag it into a text field to display it as a label, or use it as a filter.
You can easily create a derived attribute that:
- Changes the data type of an existing attribute. The derived attribute can be a string, number, or date. The original attribute is not modified and remains on the dashboard.
- Changes a existing metric to an attribute. Each value in the metric appears as a separate value in the attribute. The original metric is not modified and remains on the dashboard. See Manage Dataset Objects for more information.
- Creates additional date-related attributes, for any date attribute. This allows you to improve the depth of time-related information available for your data by generating attributes containing higher levels of time data based on an existing attribute in a dashboard. If the attribute contains month data, the Year attribute, which contains the year of each month, can be generated. See Manage Dataset Objects for more information.
You can also create more complex derived attributes, using the functions available in the Attribute Editor.
Your dashboard contains the Employee attribute, which contains separate attribute forms for the first name and last name of each company employee. An attribute form is a descriptive category for any data that you save about any of its attributes. You want to display the first initial and last name of each employee. You can create a derived attribute based on Employee, using the Concatenation function to combine the first letter of the first name and the last name. The derived attribute has the following definition:
Concat(Leftstr(Employee@FirstName,1),".",
Employee@LastName)
When the derived attribute appears in a visualization, it displays each employee by first initial and last name.
You can use a derived attribute to turn a Salary metric into a Salary Range attribute.
Define the attribute's values as salary bands, such as 20K and 50K. Create a derived attribute with the following definition:
Concat(LeftStr(toString(Salary), (Length(toString(Salary))-4)), "0", "K")
To display the salary bands in thousands, change the definition to the following:
Concat(LeftStr(toString(Salary), (Length(toString(Salary))-3)), "K")
A derived attribute contains only the ID attribute form by default, but you can define additional attribute forms for the derived attribute. Any attribute forms besides the ID attribute form must be based on the value of the ID attribute form.
Sorting is one reason to create an additional form rather than another derived attribute.
Your dataset contains a Date attribute in the format MM/DD/YY. You need to display the days of the week rather than the date. You create a derived attribute that performs this transformation, returning values of Sunday, Monday, Tuesday, etc. You want Sunday, the first day of the week, to appear first, followed by Monday, etc. Create the derived attribute with the following two forms:
-
The ID form contains the default sort order.
DayOfWeek(Date@ID)
-
The Desc form contains the description.
ToString<Pattern=ddd>(Date@ID)
The derived attribute, when it appears in a visualization, sorts according to the ID form.
Related Topics
Create a Derived Attribute by Changing an Attribute's Data Type