官术网_书友最值得收藏!

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:

  1. Double-click on the Date dimension in Solution Explorer.
  2. In the Dimension designer, go to the Browser tab; you can see all the members of the Date Key attribute there. Members of the Date Key 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.
  3. Go to the Dimension Structure 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.
  4. Then rename the Date Key attribute to Date.
  5. Drag-and-drop CalendarYear from the Data Source View pane to the Attributes pane.
  6. Drag-and-drop MonthNumberOfYear from the Data Source View pane to the Attributes pane.
  7. 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.
  8. 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.
  9. 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.
  10. Go back to the Dimension Structure tab. Select the Month attribute, and then in the Properties window, change the OrderBy property to Key.
  11. 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).

主站蜘蛛池模板: 古蔺县| 祁连县| 江北区| 滨州市| 乃东县| 黎城县| 香河县| 通化市| 焉耆| 图片| 宁阳县| 安多县| 嘉黎县| 灌南县| 静宁县| 夹江县| 平昌县| 阿图什市| 贵定县| 乌拉特后旗| 志丹县| 乌恰县| 平塘县| 绵阳市| 读书| 罗定市| 仁化县| 镇康县| 登封市| 林芝县| 都兰县| 东兰县| 龙口市| 托里县| 上蔡县| 黄冈市| 鸡泽县| 河北省| 神木县| 治县。| 延庆县|