- Microsoft SQL Server 2014 Business Intelligence Development Beginner’s Guide
- Reza Rad
- 523字
- 2021-08-13 17:55:22
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 Solution Explorer.
- 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.
- 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.
- Then rename the
Date Key
attribute toDate
. - Drag-and-drop CalendarYear from the Data Source View pane to the Attributes pane.
- Drag-and-drop MonthNumberOfYear from the Data Source View 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 Dimension Structure 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).
- Java系統分析與架構設計
- Mastering JavaScript Object-Oriented Programming
- Docker進階與實戰
- 編程卓越之道(卷3):軟件工程化
- TestNG Beginner's Guide
- Java:High-Performance Apps with Java 9
- Android開發:從0到1 (清華開發者書庫)
- Jenkins Continuous Integration Cookbook(Second Edition)
- Swift Playgrounds少兒趣編程
- Hands-On Kubernetes on Windows
- Java并發編程之美
- Vue.js 3應用開發與核心源碼解析
- Learning Ionic
- 遠方:兩位持續創業者的點滴思考
- UX Design for Mobile