# Creating attributes

An attribute is used to create a single level hierarchy, using either a field or existing hierarchy level.

## Create an attribute on a field

These steps guide you through creating an attribute using the Annotate Stream step.

1. If you have not done so already, complete steps 1-7 in [Use the Annotate Stream step](https://docs.pentaho.com/pdia-data-integration/extracting-data-into-pdi/work-with-the-streamlined-data-refinery/use-the-streamlined-data-refinery/building-blocks-for-the-sdr/using-the-annotate-stream-step/use-the-annotate-stream-step).
2. Select **Create Attribute** from the **Actions** menu.

   The **Name - Value** table auto-populates with a list of annotation properties for the attribute.

   ![Create an attribute](https://773338310-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYwnJ6Fexn4LZwKRHghPK%2Fuploads%2Fgit-blob-3e620e75197c954d69cfc34b24773f8f78f8a7e8%2FSDR_AnnotateStream_Annotate_CreateAttribute.png?alt=media)
3. Enter or edit the value for each annotation component.

| Property               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Attribute Name**     | Enter a name for your attribute. This is a required field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| **Time Level Type**    | <p>For time level attributes, specify a time level type from the drop-down menu. Options may include:- TimeYears</p><ul><li>TimeHalfYears</li><li>TimeQuarters</li><li>TimeMonths</li><li>TimeWeeks</li><li>TimeDays</li><li>TimeHours</li><li>TimeMinutes</li><li>TimeSeconds<br>This is a required field for Time Level attributes.</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Time Source Format** | <p>For time level attributes, specify a time format for the attribute to appear in. Options are dependent on the selected time level type. For example, if you select <strong>TimeYears</strong> in the <strong>Time Level Type</strong> field, then you can only select <strong>yyyy</strong> or <strong>yy</strong> in the <strong>Time Source Format</strong> field. This is a required field for Time Level attributes.</p><p>See <a href="http://wiki.pentaho.com/display/Reporting/Date+Formatting+Table">Date Formatting Table</a> for more information on selecting the appropriate format.</p>                                                                                                                                                                                                                            |
| **Geo Type**           | <p>For geo attributes, specify the geo type from the drop-down menu. Options may include:- Location</p><ul><li>Country</li><li>City</li><li>State</li><li>County</li><li>Postal\_Code</li><li>Continent</li><li>Territory<br>This is a required field for Geo Type attributes.</li></ul>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **Latitude**           | <p>If you select a Geo Type of <strong>Location</strong>, select an existing value from the drop-down menu.</p><p>If you do not select values for <strong>Latitude</strong> and <strong>Longitude</strong>, then the system will attempt to assign approximate values for these two fields.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Longitude**          | <p>If you select a Geo Type of <strong>Location</strong>, select an existing value from the drop-down menu.</p><p>If you do not select values for <strong>Latitude</strong> and <strong>Longitude</strong>, then the system will attempt to assign approximate values for these two fields.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| **Ordinal Field**      | Select a field to use for sorting members in ascending order. For example, months will display in chronological order, such as January, February, etc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| **Format**             | <p>Choose how this attribute should be formatted, such as currency, general number, percentage, or date. Use the drop-down arrow to select a format from a system-defined list, or type in the field to enter a custom format. For example, to display the attribute as a simple date, you might select <strong>MM/dd/yy</strong>. Note that the <strong>Format</strong> field only displays when the value for the attribute is a number or a date.</p><p>See <strong>Pentaho Business Analytics</strong> for more information on selecting the appropriate format.</p>                                                                                                                                                                                                                                                           |
| **Description**        | Enter a description for the attributes. This description is visible when a user mouses over an attribute in Analyzer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **Parent Attribute**   | If you want to create multi-level hierarchies, select a parent attribute for the attribute you are creating. This relationship will display in the **Summary** column for the annotation on the Annotate Stream dialog box. For example, if you are working with Month, then you can select **Year** as the parent attribute. Double-clicking **Year** in the model displays **Months**.                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| **Dimension**          | Select an existing dimension or create a new dimension for the attribute. This is a required field.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| **Hierarchy**          | Select an existing hierarchy or create a new hierarchy for the attribute. This field may be left blank.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| **Is Unique**          | <p>Set to <strong>True</strong> when member names do not repeat under different parents. Setting this field to <strong>True</strong> will optimize SQL generation in Mondrian.</p><p>Set to <strong>False</strong> when member names may repeat under different parents.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Hidden**             | <p>Set to <strong>True</strong> to prevent this attribute from displaying as an available level in Analyzer. When set to <strong>True</strong>, this attribute is included in the model, but is not visible to users when the model is published and opened in Analyzer.</p><p>Set to <strong>False</strong> to allow this attribute to display as an available level in Analyzer. When set to <strong>False</strong>, this annotation is visible to users when the model is published and opened in Analyzer.</p><p>The <strong>Hidden</strong> property is useful for attributes needed to build a proper data model, but not needed for analytic purposes. For example, if you are in a multi-tenant environment, you may want to hide the <strong>Tenant ID</strong> attribute while still including it in the data model.</p> |

\- For all annotations, enter the \*\*Attribute Name\*\* and select the \*\*Dimension\*\* type. Optionally, you can enter an ordinal field, write a description, choose a hierarchy, and designate if the attribute \*\*Is Unique\*\*.\
\- For Time Level attributes, select a \*\*Time Level Type\*\*, a \*\*Time Source Format\*\*, and optionally set a parent attribute if you want to create a relationship between two time attributes.\
\- For Geo attributes, select a \*\*Geo Type\*\* and optionally set a parent attribute if you want to create a relationship between two geo attributes.\
4\. Use the \*\*Previous\*\* and \*\*Next\*\* buttons to navigate through the fields. When finished, click \*\*OK\*\* to add the attribute to the annotations list or \*\*Cancel\*\* to close the dialog box without saving your annotations.
