Pro SQL Server 2008 Analysis Services- P4

50 400 0
Pro SQL Server 2008 Analysis Services- P4

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

CHAPTER 6  CREATING DIMENSIONS 131 Figure 6-16. Setting the deployment server 18. Select the Build menu and then Deploy SSAS AdventureWorks to deploy the solution to the server. 19. Now either click the Process button ( ) or choose Dimension ➤ Process. 20. When the Process Dimension window comes up, click Run. (We’ll dive into this window in depth in Chapter 8.) 21. Now we can browse our dimension. In the dimension designer, click the Browser tab. 22. You should see a single member labeled All. Expand it by clicking the [+] icon next to it. You should see something like Figure 6-17. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 132 Figure 6-17. Our new dimension? 23. That’s odd. Hold on—look at the Hierarchy selection. These are the available Discount Percentages. Change the selection to Promotion Key and open the tree again (Figure 6-18). Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 133 Figure 6-18. The promotions in the dimension 24. This looks more like a list of dimensions. So how do we make them come up first? We’ll use a little trickery. Let’s also clean up the dimension a bit. Click the Dimension Structure tab again. 25. Right-click English Promotion Category, select Rename, and rename it Category. 26. Similarly, rename English Promotion Type to Type, and Promotion Key to Promotion. 27. Now we’re going to create a hierarchy. Drag Category to the Hierarchies section in the middle of the designer. This will create a Hierarchy container. Drag Type to the <new level> area under Category. 28. Finally, drag Promotion under Type. 29. Right-click Hierarchy and select Rename. Rename the hierarchy Promotions. It should look like Figure 6-19. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 134 Figure 6-19. The Promotions hierarchy 30. Note that little blue squiggle under Promotions in the hierarchy. See the upcoming section, “Analysis Management Objects (AMO) Warnings,” for more about that. For now don’t worry about it. 31. Save the dimension and process it again. 32. Click the Browser tab. (You will likely have to click on the Reconnect link in the yellow bar at the bottom to refresh the connection.) 33. In the Hierarchy tab, select Promotions. Note that now the promotions are all structured in an easy-to-browse tree (see Figure 6-20). Figure 6-20. The finished Promotions hierarchy Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 135 In this exercise, we talked a lot about attributes and hierarchies. Let’s take a deeper look at what they are and how they factor into cube design. Analysis Management Objects (AMO) Warnings In Exercise 6-2, we see a little blue squiggle in a hierarchy. When we mouse over it, we see a warning (Figure 6-21). This is an Analysis Management Objects (AMO) warning, a new feature in BIDS 2008. AMO warnings are best-practice recommendations to aid in design of Analysis Services cubes. In this case, the warning is pointing out that there is no relationship defined between the Type and Promotion attributes (more on this in the “Attributes” section later in this chapter). Figure 6-21. An AMO warning in BIDS BIDS has dozens of design warning rules that it runs against OLAP designs as you work. The warnings will show up as you work. AMO warnings won’t keep you from saving or processing cubes or dimensions. You can choose to ignore warnings, either on a case-by-case basis, or you can dismiss a warning globally. To dismiss a warning, open the Error List pane (View menu ➤ Error List). Find the error and then right-click on it. Click Dismiss, and the Dismiss Warning dialog box will open (Figure 6-22). Note that you can enter comments. These comments will be stored with the database for future reference. For example, this same warning was dismissed in the AdventureWorks database. Let’s take a look at why. Figure 6-22. Dismissing an AMO warning Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 136 To view the status of warnings in a database, right-click the database name (the project in the Solution Explorer) and select Edit Database. In the designer that opens, click the Warnings tab (Figure 6-23). Figure 6-23. Reviewing AMO warnings The top section lists the design warning rules available. They’re grouped by type of object (Cube, Data Source, and so on), and ranked by importance. You can come in and deselect rules that you don’t want enforced. In the lower window are the warnings you’ve dismissed for the current database (including comments you made when you dismissed them). You can highlight a dismissed warning and click the Re-enable button to put the warning back in place. Dimension Properties Now that you’ve built a dimension, let’s dig into the features and properties. These are accessible by right-clicking on the dimension name in the attributes pane on the left, in Visual Studio, and selecting Properties. The following subsections describe each of the properties that you see. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 137 Dimension Type You can flag a dimension with a type—the default is Regular. For the most part, the dimension type is an indicator for client applications on how to treat a dimension. For example, if a dimension is the Customer type, a client application may provide a way to map the dimension to contact cards or a personnel selector-type control. Note that Account, Currency, and Time dimension types do have special handling built into SSAS—we’ll look at them separately. The dimension types are as follows: Account: This dimension represents a chart of accounts (revenues, losses, profits, expenses, and so forth). An Account dimension type can be managed such that specific account types are positive or negative solely based on the account definition. Bill of Materials: A Bill of Materials type will contain manufacturing or inventory information (unit of measure, cost, packaging). Channel: Used in retail sales, a Channel dimension will indicate the sales channel used (wholesale, retail, partners). Currency: The Currency dimension is designed to reflect the financial requirements of dealing with international transactions. SSAS has a currency-conversion feature to manage these transactions. Customer: A Customer dimension will have standard attributes for customers and contact information. Geography: If you want to designate attributes as addresses, cities, and zip codes, then set the dimension type as Geography. You can also have spatial data types in a Geography dimension type. Organization: Employee names, positions, offices, and branches can all be defined in an Organization dimension. Product: A Product dimension will have attribute types for brands, SKUs, and product categories. You can also add attributes for product start and end dates. Promotion: If you need to group facts by the type of deal the buyer got, you can use a Promotion dimension type, including minimum and maximum quantities, start and end dates, percentage discounts, and so on. Quantitative: Quantitative is more a general description than an actual dimension type, and more of a collection of measurement-oriented attributes (volume, weight, color, maximum, minimum, and so forth) than anything else. Rates: Generally a dimension for measuring exchange rates. Scenario: Scenarios are a fascinating capability of an OLAP solution. Because any dimension can “slice” the fact data into exclusive collections (sales in Europe, North America, or Asia), we can create a dimension solely for creating scenarios. For example, a scenario may have members for “5 percent growth,” “No growth,” and “5 percent decline.” Selecting each member then groups the data for that scenario. You’ll revisit the concept of scenarios when you look at writeback in Chapter 7. Time: A Time dimension represents a calendar—days, weeks, months, quarters, years. The Time dimension is very special, as we’ve seen previously, and we’ll cover time dimension types specifically later in the chapter. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 138 Utility: A Utility dimension is basically a catchall for some aspect of the data that may not be reflected in the business rules. Each of these dimension types has a host of matching attribute types (Figure 6-24). In general, you can “mix and match” attribute types with dimension types, though some of the special types can be used only in their matching dimension type. If you mismatch types, you’ll get an AMO warning on the dimension. Figure 6-24. Selecting attribute types After you’ve set a dimension type and assigned attribute types, OLAP client applications can leverage known dimension types in business logic. For example, a sales and marketing analysis tool could pull promotion and channel dimensions from your cubes and align them with the analysis system. I mentioned that Account, Currency, and Time dimension types are special. In addition to being able to be leveraged by client applications, each of these dimensions can be specified within SSAS to work in special ways. Let’s open AdventureWorks and look at the Account dimension (Figure 6-25). Note that the table in the data source view is self-referential. It has a field that is a foreign key for the table’s primary key, to indicate the parent account. This creates the recursive hierarchy of accounts in the dimension. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 139 Figure 6-25. The Account dimension in AdventureWorks Now let’s look at the dimension browser (Figure 6-26). You might not notice at first, but various accounts have plus or minus signs on their icons in the browser. That’s because the DBA set up account business intelligence on the dimension. When you run the Add Business Intelligence Wizard (Dimension menu), it walks you through mapping an accounts table to built-in logic for standard accounts. In addition, the UnaryOperatorColumn was set to the Operator column of the Account table. In a parent- child hierarchy dimension, setting the Unary Operator on the parent attribute indicates to Analysis Services to use that column to determine how to aggregate that member. Figure 6-26. Browsing the Account dimension Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. CHAPTER 6  CREATING DIMENSIONS 140 Currency dimensions have similar logic that can be added via the business intelligence wizard. The wizard is pretty straightforward. You will want a table of exchange rates by time period to handle the automatic currency conversion. One aspect you will have to know is your preferred method of handling local currencies. SSAS will want one of the following three scenarios: Many-to-many: All transactions are recorded in the local currency. Currency conversion is applied at the cube level and can target many currencies. Many-to-one: All transactions are recorded in the local currency. Conversions are applied at the cube level to the corporate standard currency. One-to-many: All transactions are recorded in a single currency. The conversion is applied at the cube level with multiple target currencies. So if all your sales are reported in the local currency, you can set up a currency dimension and conversion rate table, apply the business intelligence wizard, and you can roll up aggregated sales figures with conversions automatically applied. ErrorConfiguration This section of properties refers to how Analysis Services should handle errors that crop up while processing the dimension. Think of a dimension as a lookup table—one thing that’s necessary is a primary key value to link the dimension and subordinate attributes to records in the cube. So when processing the dimension (reading in the data, parsing it for attributes and relationships, and then caching the dimension data), if multiple records have the same key value, SSAS will throw an error. You can indicate how to handle the error here. The default action is to ignore the error and continue processing. You can see how this may cause problems, so you might want to change this to either ReportAndContinue or ReportAndStop if you have a data source where you expect you may get duplicates. Both IgnoreError and ReportAndContinue will leverage the KeyErrorAction setting—either converting the key to an Unknown catchall value or discarding the record. MdxMissingMemberMode This setting indicates how Analysis Services should handle queries or calculations that reference a member that doesn’t exist in the dimension. The default setting is Default, which means the error will be handled in accordance with the settings in Analysis Services and the cube. You can also specifically set this to error out or ignore the error. Processing These options govern how the dimension is processed. You should generally leave the setting for ProcessingGroup at the default value of ByAttribute. ByTable is used for a small subset of cases generally involving very large dimensions (millions of rows). Setting ProcessingMode to LazyAggregations will make the dimension available for use while it’s still being processed, but as a result, processing will take longer. ProcessingPriority allows you to prioritize the order in which dimensions are processed. You might want certain dimensions (such as Time) available sooner, for example, while other less-used dimensions are processed afterward. Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... 6-39 Figure 6-39 The Product dimension after finishing the wizard 10 We want to make the key values more descriptive and appropriate for end users Click on the Product Key attribute 11 Right-click on Product Key in the left-hand attributes pane, and select Rename 12 Change the name to Product 13 Check the properties for this attribute The NameColumn property should be Product.EnglishProductName This way,... Look at the Products hierarchy and make sure you can navigate down categories, subcategories, and products 27 Save the project; we’ll keep using it Attribute Properties Let’s take a look at the properties for an attribute Select an attribute and then view the Properties pane (right-click and then select Properties) Let’s work down the Properties pane and look at some of the more significant properties... applet: o Windows Server 2003: Right-click on My Computer, click Manage In the Computer Management applet, open Services and Applications and click Services o Windows Server 2008: Right-click on Computer and click Manage In the Server Manager applet, open Configuration and then click Services 26 Scroll down to find the SQL Server Analysis Services service Right-click on it and select Properties 27 Click... the user sees proper name values instead of key numbers in the list of Products 154 Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark CHAPTER 6 CREATING DIMENSIONS 14 Rename Product Category Key to Category and Product Subcategory Key to Subcategory the same way 15 Change the NameColumn property for Category to EnglishProductCategoryName 16 Change the NameColumn property for... 6-32) Figure 6-32 The Log On properties for the SSAS service 28 Note the account named; because the data source is using this account to access the data source, this is the account we have to provide for 29 Close the dialog box and management applets 30 Go back to SQL Server Management Studio 31 Right-click on the server in the Object Explorer and select Properties 32 In the Properties dialog box, select... quantities, promotion category, type, and name Each of these is amplifying information for each promotion in the dimension Figure 6-34 Attributes on the Promotion dimension Attributes are often called containers for dimension members I find the adjective concept easier to grasp However, you can see how that approach works—take all the Promotion categories, and each one is something of a “bucket” for the promotions... table 5 Open SQL Server Management Studio 6 Connect to the server where the Adventure Works DW2008 database is located (Database Engine connection) 7 Open the AdventureWorks DW2008 database and then the Tables folder 8 Right-click on the dbo.DimPromotion table and select Edit 250 Rows 9 CREATING DIMENSIONS Find the promotion where the EnglishPromotionName is Mountain Tire Sale Change the name to Mountain... CREATING DIMENSIONS Figure 6-31 Setting proactive caching 21 Click the Notifications tab Note that SQL Server is selected and Specify Tracking Tables is not selected Click the OK button to return to the Dimension Storage Settings dialog box, and click the OK button there Now we’re going to go check our permissions What we need is for the account that connects to the SQL Server database to have ALTER TRACE... blue bicycles, or use an MDX query like the following, to show sales by product for all products with a list price over $1,000.00 We’ll dive into MDX in Chapter 9 WITH MEMBER Measures.[List Price] AS [Product].[List Price].CurrentMember.MemberValue SELECT {[Date].[Fiscal].[Fiscal Quarter].Members} ON COLUMNS, Filter([Product].[Product].Members, (Measures.[List Price]>1000)) ON ROWS FROM [Adventure... follows: SQL Server: SSAS simply sets a trace on the necessary tables in SQL Server and tracks for data changes You can select the Specify Tracking Tables check box and explicitly list the tables SSAS should track for changes (remember, all that will happen is that SSAS will rebuild the dimension if any changes to the data in the indicated tables are detected) If you don’t specify the tables, Analysis . the SQL Server Analysis Services service. Right-click on it and select Properties. 27. Click the Log On tab (Figure 6-32). Figure 6-32. The Log On properties. dimension. Product: A Product dimension will have attribute types for brands, SKUs, and product categories. You can also add attributes for product start

Ngày đăng: 24/10/2013, 09:15

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan