Time for action – change the order of the Month attribute
For this example, we will add some attributes to the date dimension, such as a month attribute, and we will then change the ordering of that attribute to show the correct order as shown in the following steps:
Double-click on the Date dimension in SolutionExplorer.
In the Dimension designer, go to the Browser tab; you can see all the members of the Date Key attribute there. Members of the DateKey attribute are integer values with the YYYYMMDD format. This format is not well formed from the business user's perspective. In this example, we will change this format and also add two other attributes for the year and month.
Go to the DimensionStructure tab, select Date Key in the Attributes pane, then in the Properties window, click on the ellipsis button of the NameColumn property. In the Name Column dialog box, select FullDateAlternateKey and click on OK.
Then rename the Date Key attribute to Date.
Drag-and-drop CalendarYear from the DataSourceView pane to the Attributes pane.
Drag-and-drop MonthNumberOfYear from the DataSourceView pane to the Attributes pane.
As the Month Number of Year view only shows values such as 1, 2,… 12, we need to change it to show the month names. So, change the NameColumn property of this attribute to EnglishMonthName. Also, rename this attribute to Month.
Process the dimension and go to the Browser tab; if you choose Date in the hierarchy drop-down list, you will see values such as 2005-01-01, which is what we want.
If you choose Month in the hierarchy drop-down list, you will see that the month names are visible, but they are not in the correct order.
Go back to the DimensionStructure tab. Select the Month attribute, and then in the Properties window, change the OrderBy property to Key.
Process the dimension and go to Browser, and you will see that the month's values are shown in the correct order this time.
What just happened?
In this example, you used two other properties of the dimension attributes. You used those properties to change the order of the values and also to change the display values of an attribute. You also learned how to make changes in the dimension structure and check results in the browser.
In step 3 and step 7, we changed the label value of the attributes with the help of NameColumn. While configuring the NameColumn property to another column in the data source view, the value of that column will be shown in Browser, but the value of the KeyColumn(s) will be used in aggregations and calculations. You did that for Month and Date full format in the preceding example.
Using the OrderBy attribute, you changed the order of the Month attribute to Key. This means that this attribute will be sorted based on KeyColumn, and because the KeyColumn is MonthNumberOfYear and it is an integer value, it will be ordered correctly (refer to step 10). It is also possible to sort one attribute based on another attribute's Name or Key column (using the OrderByAttribute property).