This action might not be possible to undo. Are you sure you want to continue?
Nowadays, analytical solutions are becoming mission critical for many organizations. Microsoft SQL Server 2008 Analysis Services (SSAS) is designed to provide exceptional performance and scalable support with millions of records and thousands of users from different locations. Why to Build a Cube? There are many advantages of cube over relational data mart. While querying a data mart, you can get most of the results but not everything you need for business analysis and decision making. Cube can help you to get answers of all "What-If" scenarios. Building a cube helps to house your data to centralize the business rules for calculations that you can't easily store in a relational data mart. The structure of the cube makes it much easier to write queries to compare data year over year (YOY), or to create cumulative values such as year-to-date (YTD) sales. Scalable Infrastructure - Analysis Services can scale to support databases of many terabytes in size with many thousands of users. Superior Performance - Analysis Services cubes are multidimensional structures that enable fast access to high volumes of pre-aggregated data, empowering end users to gain insight into relevant business data at the speed of thought. You gain the ability to manage aggregated data in the cube. To improve query performance in a relational data mart, we often create summary tables to prepare data for queries that don't require transaction-level detail. SSAS creates the logical equivalent of summary tables (called aggregations) and keeps them up-to-date.
I would like to introduce beginners to Microsoft SQL Server Analysis Services (SSAS) by creating a simple cube from AdventureWorksDW2008R2. You can install this database from codeplex. I'll cover following things in this article: 1. 2. 3. 4. 5. 6. Creating Analysis Services Project Creating Data Source Creating Data Source View Creating Cube and Dimensions Creating Dimension Hierarchies Deploying Cube Database from BIDS
Creating Analysis Services Project. First step is to create a project in Business Intelligence Development Studio (BIDS). Launch BIDS from Start --> All Programs --> Microsoft SQL Server 2008 --> SQL Server Business Intelligence Development Studio and then click File --> New --> Project. In the New Project dialog box, select Analysis Services Project. In the Name text box, type Learns AS and, if you like, change the location for your project. I'll store this project at location D:\Hari. Click OK to create the project.
Creating Data Source Now add a data source to define the connection string for data mart AdventureWorksDW2008R2. In Solution Explorer, right-click the Data Sources folder and click New Data Source.
In the Data Source Wizard, click Next on the Welcome to the Data Source Wizard page if it hasn't been disabled. On the Select how to define the connection page, click New to set up a new connection. In the Connection Manager, the default provider is the Native OLE DB\SQL Server Native Client 10.0, which is correct for our project. To define the connection, type the name of your server in the Server Name text box. Alternatively you can select it from the drop-down list, then select AdventureWorksDW2008R2 in the database drop-down list and click Test Connection button to check the connection. Finally click on OK as shown below:
When you're back in the Data Source Wizard, click Next. On the Impersonation Information page, select Use the service account option so that service account will be used to read data from the source when loading data into your SSAS database and service account must have read permissions to do so. Click Next and then Finish to complete the wizard. Creating Data Source View Now next step is to create a data source view (DSV) from the data source to define dimensions and cubes. You can make changes to the DSV without modifying the actual data source, which is very useful if you have only read permissions to the data mart. In Solution Explorer, right-click on the Data Source Views folder and then click New Data Source Views...You can see Data Source View Wizard. Click Next on the Welcome page. On the Select a Data Source page, select the data source just added to the project (Adventure Works DW2008R2.ds) and click Next. Now add required objects to the DSV by double-clicking each table or view on Select Tables and Views page. I want to add the following tables to the DSV to make it easy to understand for beginners: DimDate, DimProduct, DimProductCategory, DimProductSubcategory, and FactInternetSales. You can always add more tables later if you want to explore advance BI questions. Now click Next in the Data Source View Wizard once you are finished adding required tables followed by click on Finish. You can give a name to your DSV before clicking Finish button. I would recommend you to change the name of objects by selecting each one in the DSV designer and remove the Dim and Fact prefixes from the FriendlyName property because when you create dimensions and cubes, only FriendlyName property will be assigned to the objects. The DSV is shown below:
Creating Cube and Dimensions Next step is to create a Cube and Dimensions from the data source view. In Solution Explorer, right-click on the Cubes folder and then click New Cube...You can see Cube Wizard. Click on Next in Welcome to the Cube Wizard page.On the Select Creation Method page, keep the default option Use existing tables
In the Completing the Wizard page. On the Select Measure Group Tables page. Select only the following measures from Internet Sales Group: Order Quantity.and click Next button. and Internet Sales Count Now click on Next button to open Select New Dimensions page and select Date and Product dimensions. Cube layout is shown below: . Sales Amount.g. Unit Price. Measures are basically numeric values e. Now the wizard displays all the measures available in the selected measure group tables. Tax Amount etc. choose InternetSales table and click Next. Unit Price. OrderQuantity. Total Product Cost. Click Next to proceed. enter the cube name as AdventureWorksCube and click Finish button to complete the wizard. Sales Amount.
Calendar Year. EnglishMonthName. You'll see a warning mark in the hierarchy because attribute relationship is not set properly. and EnglishDayNameOfWeek. Calendar Week . Date Dimension: Drag and drop FullDateAlternateKey. Creating Dimension Hierarchies Navigate to Date Dimension Structure. Calendar Month. Rename hierarchy with Calendar. and EnglishDayNameOfWeek with Calendar Week as shown below: Product Dimension: Drag and drop EnglishProductCategoryName from ProductCategory table. EnglishMonthName with Calendar Month.Now click on each dimensions and add required attributes from the Data Source View. and Full Date attributes. Rename FullDateAlternateKey with Full Date. Drag and drop Calendar Year attribute into Hierarchies surface area following by Calendar Quarter. EnglishProductSubcategoryName from ProductSubcategory table and Color. CalendarQuarter. ModelName. . Size and Weight from Product table.
Now right click on the project and click on Process to Build and Deploy the project. Click on Yes to proceed. Right click on the project (LearnSSAS in this example) and click properties to open project properties page. You will a message while deploying the database first time.PreojectName window. Select Related Attribute as Calendar Week and Relationship type as Rigid (will not change over time).Set Attribute Relationships Click on the Attribute Relationships tab in the dimension designer. all attributes relate directly to the key attribute. This tab is available only in Analysis Services 2008. . By default. Enter Server Name name Server property and Database name in Database property as shown below: Click OK to save changes. Right Click on Full Date and select New Attribute Relationship. Finally Attribute Relation will look like below image: Deploying Cube Database from BIDS Now its time to deploy the cube at required server. Now you can see Process Database . Date Key as shown below: To optimize the design by reassigning relationships. Repeat same thing for remaining attributes. Click on Run to continue.
You can also pull cube data in Excel using Excel OLAP Pivot Tables. An action is an event that a user can initiate when accessing cube data. Returns a string that can be interpreted by a client application. which is the prefered option used by business managers. One of the objects supported by a SQL Server Analysis Services cube is the action. For example. o Proprietary. Actions haven't been well-documented until now. . o Rowset. open a Web page. Adding Actions to a Cube in SQL Server Analysis Services 2008 Actions are powerful way of extending the value of SSAS cubes for the end user. The event can take a number of forms. Drillthrough. Returns a mutlidimensional dataset. Standard. Robert Sheldon once more makes everything clear. you can see the data through Browser tab or directly through SQL Server Analysis Services.Once the database is deployed and processed successfully. Returns a Reporting Services report that is associated with the cube data on which the action is based. or to retrieve information about the selected item. a user might be able to view a Reporting Services report. Returns a result set that provides detailed information related to the cube data on which the action is based. They can click on a cube or portion of a cube to start an application with the selected item as a parameter. One of five action subtypes that are based on the specified cube data: o Dataset. or drill through to detailed information related to the cube data Analysis Services supports three types of actions: Report. Returns a tabular rowset.
A data source view that includes the tables shown in Figure 1. . URL. A data source that points to the AdventureWorksDW2008 database on a local instance of SQL Server 2008. The cube I use for my examples is based on the one I describe in the article "Five Basic Steps for Implementing an Analysis Services Database".o o Statement. Returns a command string that can be run by a client application. A cube based on the database dimensions as well as on the two fact tables in the data source view. 2. you’re ready to add actions to your soluti on. The article explains how to create the cube necessary to support the action I describe in this article. Returns a URL that can be opened by a client application. Figure 1: Default diagram from the Sales data source view Be sure to refer to the article mentioned above for more details about the solution. For that solution. usually a browser. the configuration of each one is unique. Although the basic steps necessary to implement the various types of actions are similar. 4. Database dimensions based on each dimension table in the data source view. 3. Once you’ve created the database. In this article. I created the following database components: 1. You can also refer to SQL Server Books Online for more information about how to implement an Analysis Services database and its cubes. I explain how to add a drillthrough action to your cube.
be sure to update the Customer dimension to include the FullName column. Name the column FullName and provide a description. In the Tables pane of the data source view design surface. Open the data source view in Business Intelligence Development Studio (BIDS). For our drillthrough action example. In this case. You create named calculations in the data source views that you reference in your dimensions and measure groups. add the following expression: FirstName + ' ' + LastName The Create Name Calculation dialog box should now look similar to the one shown in Figure 2. we’ll update the DimCustomer table of the Sales data source view. To support this action. Creating a Drillthrough Action . Figure 2: Creating a named calculation on the DimCustomer table Once you’ve added the named calculation. In the Expression text box. you can reference it in your dimensions and cubes as you wo uld any other column in a data source view. we’ll first create a named calculation that concatenates the customers’ first and last names. and then click New Named Calculation. and process the cube as necessary so the named calculation will be available to your action.Creating a Named Calculation The drillthrough action that I describe allows users to view a list of customers associated with aggregated Internet sales. right-click the DimCustomer node.
To ensure that the drillthrough action applies only to those aggregated totals that have sales. as shown in Figure 3. the Sales Amount measure must contain a value greater than 0 for the action to be available to the user. select Fact Internet Sales from the Measure group members drop-down list. I used Customer drillthrough. . Our action will be based on the aggregated totals for Internet sales. The next property. click the New Drillthrough Action button.[Sales Amount] > 0 As you can see.To add a drillthrough action to a cube. Next. Condition. add the following expression to the Condition dialog box: [Measures]. Although this property is optional. open the cube in BIDS. A new form is displayed in the design pane. is a Multidimensional Expressions (MDX) statement that returns a Boolean value. but you can use whatever you think is appropriate. if there are no sales for a particular category of cube data. Figure 3: Adding a drillthrough action to an Analysis Services cube The first thing to do is to give the action a name. On the Actions tab of the cube designer. In other words. the user should not be able to drill down to an empty dataset. we will create an expression to ensure that the action can be triggered only when a cell contains a value.
Otherwise. The default value. It has to do with how drillthrough actions are evaluated when a DRILLTHROUGH statement is executed by a client application. The caption can be a simple string or it can be an MDX expression. Your drillthrough action form should now look similar to the one shown in Figure 4. specifies that the action will run when the user chooses to run the action.[Sales Territory Region]. Interactive. but you can type in any description you want. If the Caption property is an MDX expression.MEMBER_CAPTION + " customers" The expression concatenates two strings with the current sales territory region. For our example action. you simply select the dimension and its columns that you want returned by the drillthrough action. it should be set to False. However. which determines the maximum number of rows that will be included in the drillthrough dataset. we’ll stick with Interactive. or not include a description at all. . For our e xample. The Caption property determines what text is displayed when referencing the action. we’ll leave this property blank. I used Describes the action. or you can set the property to On Open so the action runs when the cube is first opened. of course. The Invocation property determines when the action should run. if the region is Northeast. Configuring Additional Properties If you refer back to Figure 3. must go with True. The next additional property is Maximum rows.CURRENTMEMBER. We. For our example. However. Click those arrows to access the properties. It does not control access to the action. is included for backward compatibility. you’ll notice that there’s a set of down arro ws for additional properties. you can set the property to Batch to indicate that the action should run as part of a batch operation. then the Caption is MDX property should be set to True. For the Description property. In this case. I’ve set the property to 50. we’ll use the FullName attribute (based on the named calculation) in the Customer dimension.The next property that must be configured for the action is Drillthrough Columns. simply type in a description for your action. The next property. The first additional property. You can leave its value as False. you can add additional attributes or measures to see how they work. In this case. is the name of an application that can run the drillthrough action. Default. The final property is Caption is MDX. we’ll use the following MDX expression: "Drillthrough to " + [Territory]. Later. but you can set it to whatever number you think appropriate. Application. the caption will read Drillthrough to Northeast customers. For example. You can use this property to identify which client application most commonly uses this action or to display icons next to the action in a pop-up menu. In this case. the property does nothing but provide a recommendation to the client about which application to use.
Viewing the Drillthrough Action To test the drillthrough action. you should save and process your cube. 2. Drag the Sales Amount measure from the Fact Internet Sales measure group to the Detail Fields Here section of the browsing surface.Figure 4: Configuring a drillthrough action in an Analysis Services cube After you’ve configured all the properties for your drillthrough action. Drag the Sales Territory Region attribute of the Territory dimension to the Drop Column Fields Here section of the browsing surface. Take the following steps on the Browser tab of the cube designer: 1. You can then use the Browser tab of the cube designer to view the action you just created. . you’ll want to set up the browser with cube data.
as shown in Figure 6. 4.3. Drag the Calendar Year attribute from the Order Date dimension to the Drop Row Fields Here section of the browsing surface. . For example. Your browsing surface should now look similar to the one shown in Figure 5. Drag the Sales Territory Country attribute from the Territory dimension to the Drop Filter Fields Here section of the browsing surface. when I right-click the cell for 2003 sales in the Central region. Clear the All checkbox on the filter. The menu should include an option for being able to drill through to the customers. my context menu includes the option Drillthrough to Central customers. and then check the United States check box. Figure 5: Browsing sales data based on the sales territory and calendar year Right-click one of the cells that contains aggregated sales amounts to bring up the context menu.
. such as 2001 sales for the Northeast region. the drillthrough option would not be available in the context menu. These are the customers who made purchases in the specified region and year. Figure 7 shows the customers in the Central region who made purchases in 2003.Figure 6: Verifying that the drillthrough option has been added to the context menu If I were to right-click a cell that shows no aggregated totals. That’s because we included the MDX expression in the Condition property to make the action available only if there are sales. When you click the drillthrough option. a dialog box appears and displays the list of customer names.
but sales from previous years might change only occasionally . This would have made each row unique. Be sure to check out SQL Server Books Online for more information about each one of them. you can provide users with a variety of information that allows them to dig deeper into their cube data. By setting up the data source views to support the actions and then implementing the actions with the details you want to include. in a sales cube. rather than simply having duplicate names like we have now.in case if account for merchandise returns and exchanges. a portion of data warehouse is volatile and needs to be processed often. In almost all the cases. such as birth dates or annual salaries. For example. run applications. . we’ve included only the names. You can launch reports. open Web pages. Queries that summarize data over 10 years could take considerably longer than those that only search through the current year data. Better still. If we have proper partitions then SSAS only has to scan a small subset of data to return query results hence dramatic performance improvements compared to queries running against a cube with a single partition. How To Define Measure Group Partitions in SQL Server Analysis Services SSAS Partition Benefits: Better Query Performance: Cube partition is a powerful mechanism for improving query performance. we could have included the Sales Amount measure so we see the amount for each sale.Figure 7: Viewing the customer names for aggregated sales totals As you can see. If your warehouse tracks last 10 years salesthen processing only the current partition may be 10 times quicker than processing the entire cube. and a number of other tasks. but we could have included other informat ion. However other portions are relatively static. we need to change the current year's data nightly. Minimize downtime: Cube partitioning supports reducing downtime associated with cube processing. And drill through actions are only one type of many. there’s a great deal of flexibility in how you design your drill through actions. Indeed.
Step 3: Click the Internet_Sales partition (you should see the entire row highlighted as shown above) to display the partition properties. Multiple partitions are only available in the Enterprise Edition of SQL Server 2005 so you need to specify the Deployment Server Edition as Enterprise.a remote partition resides on a server different from its parent cube. Partition(s) that are used less can be processed less frequently with considerably fewer aggregations. Parallel Partitions Processing: SSAS allows processing multiple partitions in parallel on a server that has multiple processors. Click the button in the Source property to display the binding: . Customized storage and processing settings: Frequently accessed partitions might benefit from proactive caching and ROLAP storage. Aggregations benefits: The partition queried frequently could benefit from additional aggregations. Click on Internet_Sales and edit the Partition Name to Internet_Sales_2001. allowing you to take advantage of additional processing power. This can further reduce the total cube processing time. which in turn could improve performance. Step 2: Double click the Adventure Works cube in the Solution Explorer then click the Partitions tab to display the existing partitions (only the first partition is shown below). set the Deployment Server Edition to Enterprise. Properties from the top-level menu. Distributed query and processing load: SSAS allows you to create remote partitions . This way the queries that affect the remote partition are processed on a server separate from its parent cube. On the other hand. Step 1: Edit the project properties by clicking Project. other forms of storage and processing might be better for less frequently queried partitions.
Step 4: Change the Binding type from Table binding to Query binding and add the WHERE clause as shown below: .
Run the following query to determine the ShipDateKey for the date 2001-12-31 and you will see that 184 is the TimeKey value: SELECT TimeKey FROM DimTime WHERE FullDateAlternateKey = '2001-12-31' Step 5: Click New Partition (see hyperlink in Step 2 above) to add another partition to the Internet Sales measure group.The idea is to change this partition so that it only has orders that were shipped in the year 2001. The ShipDateKey column references the TimeKey column in the DimTime table (Time dimension) in the AdventureWorksDW database. Select the dbo. This will launch the Partition Wizard.FactInternetSales table under Available tables: .
Step 6: Click Specify a query to restrict rows and add the WHERE clause as shown below: .
If you query the DimTime table you will find that the TimeKey value for 2002-12-31 is 549.The idea is to set this partition so that it only has orders that were shipped in the year 2002. Step 7: Accept the defaults on the Processing and Storage Locations dialog: .
fill in the dialog as shown below: . Step 8: Complete the Partition wizard.Note that selecting Remote Analysis Services data source for the Processing location is a scale-out feature where you could actually process this partition on another SSAS server.
Repeat steps 5 through 8 to create and configure partitions for the years 2003 and 2004. Step 9: Process the cube. right click on the Adventure Works cube in the Solution Explorer and select Process from the context menu. click Run (Run button not shown below): . Accept the defaults on the Process Cube dialog.
it is possible that the Measures in the cube could belong to different parts of business. To elaborate on this . Customer related measures and Product related measures. there is a feature called Perspectives available in SSAS 2008. the different perspectives can .SSAS 2008-Perspectives When creating a cube in SSAS with the fact and dimension tables. it is possible that certain business users would like to focus on the measures to their business area. Once the cube has been created and related dimensions have been added. When the cube is deployed and is being viewed by business users. it is possible that the Cube could have Sales related measures. In order to achieve instead of having cubes split into smaller cubes based on business function.
In the Perspectives. initially one gets to see the default perspective which is a view of the whole cube with all the measures and all the dimensions. SSAS 2008: New Cube Aggregations tab The November CTP of SQL Server 2008 was released on the connect MSDN Downloads site at the end of last week and when you open up a cube in BIDS you will see a new tab for aggregations. the Perspectives tab is highlighted (this is in BIDS/Visual Studio 2008). likewise do the same for the dimensions. What this tab does is to let you see all the aggregation designs that relate to a given measure group. As with the other Analysis Services designers. Such as a particular design no being referenced by any partitions . It also lets you manage which partitions are using a particular aggregation design. I figured I might give you a bit a walk through what you can expect from this new tab. First name the new perspective and start working downwards to start choosing/Checking the Measures needed to be shown for this perspective. the new AMO warnings are also surfaced in the aggregations tab which lets you see if there are any basic issues with your aggregations. one has to click the New Perspective icon nest to the process icon in the toolbar.be created. In the screen shot below. In order to create a new Perspective.
. Right-clicking on an aggregation design gives a number of options including "Design New Aggregations".Or even an AggregationUsage property not being set properly. When you start up the "Design Aggregations" Wizard you can now easily select which aggregations a particular design is to apply to. "Usage Based Optimisation" and "Assign Aggregation designs".
.One of the coolest additions to the aggregation design wizard is the following screen which shows you the aggregation usage setting for all the attributes and gives you the ability to change them.
.The objects count screen appears largely unchanged.
As does the core Aggregation Options screen. .
But if you have a couple of different aggregation designs. "upto 150Mb". I would suggest that you might want to think about including an indication of the design options that you used. but that property did not appear to update (maybe this will change in a future build). this would let you see at a glance. etc. which is where I thought information like this would be recorded.At the end of the whole process you get to give your design a name. which was which. (eg "30 pcnt". . ) You can see a property for the aggregation level when you view the properties of the aggregation design.
When you right click an Aggregation Design and choose the option to Assign Aggregations. you get the following dialog box. This gives you a very easy way to apply a given aggregation designs to a group of partitions. .
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.