- Introduction to OLAP
- OLAP Concepts and OLAP Reporting
- Recently Added or Changed OLAP Features in Crystal Reports
- Using the OLAP Report Creation Wizard and OLAP Expert
- Advanced OLAP Reporting
- Troubleshooting
- Crystal Reports in the Real WorldOLAP Summary Report with Drill-Down
Using the OLAP Report Creation Wizard and OLAP Expert
Crystal Reports provides two easy ways to create reports against OLAP data sources. As introduced in Chapter 1, "Creating and Designing Basic Reports," Crystal provides several report wizards to step you through the creation of some popular types of reports—one of those is OLAP. The OLAP Report Creation Wizard involves five steps and walks you through the process of creating an OLAP grid and an optional supporting graphic based on an existing data source. You can access the OLAP Report Creation Wizard when you are creating a new report.
The second method of creating an OLAP-based report is through the OLAP Expert that you access from the Insert OLAP Grid on the Insert menu. This expert provides six tabs that step through the creation of an OLAP grid to be placed anywhere on a report.
The two methods of creation offer very similar degrees of functionality, and their respective dialog screens and tabs are almost identical. The OLAP Report Creation Wizard provides a built-in Charting screen not found in the OLAP Expert, whereas the OLAP Expert provides Style Customization and Label tabs not found in the OLAP Report Creation Wizard.
Specifying an OLAP Data Source
The OLAP Data tab (or screen in the OLAP Report Creation Wizard) requests the OLAP data source on which the report is to be based. This wizard and its associated dialog screens are to multidimensional data sources what the data explorer, introduced in Chapter 1, is to relational data. Figure 16.1 shows the OLAP Data screen from the OLAP Report Creation Wizard.
Figure 16.1 The OLAP Data dialog from the OLAP Report Creation Wizard.
When this screen first displays, you must use the Select Cube button to select a cube. Clicking on this button opens the OLAP Connection Browser, displayed in Figure 16.2. From the tree control presented in this dialog, select the desired cube.
Figure 16.2 The OLAP Connection Browser enables the specification of an OLAP data source for the involved Crystal Report.
To help you learn about the creation of an OLAP-based Crystal Report, here are the introductory steps to doing exactly that against SQL Server 2005's sample FoodMart Sales and Employee cube (provided at usingcrystal.com). Other exercise steps will appear throughout the chapter after the presentation of related text and figures. For now, start the OLAP Report Creation process with the following steps:
- Create a New Crystal Report by selecting the OLAP Cube Report Wizard from the Crystal Reports Start Page.
- Click the Select Cube button from the OLAP Data dialog.
- Assuming that the location of the OLAP Server has not already been identified to the OLAP Connection Browser, click the Add Server button and identify the location of your SQL Server Analysis Server and the sample Sales and Employees cube. Figure 16.3 shows the New Server dialog.
Figure 16.3 The Connection Properties dialog for a new OLAP server creates new connections to OLAP data sources.
- Enter a caption for the OLAP server you are adding. This caption appears in the OLAP Connection Browser. Enter the name of the SQL Server Analysis Server for the server name and click on OK.
- Back in the OLAP Connection Browser, navigate into the presented list of servers (there will likely be only the server you just added) and double-click on the sample Sales and Employees cube.
- Before clicking on the Next button to proceed, you see the Page Dimension Selector dialog. New to version 2008, from here you can select the specific dimensions from the cube that you would like to report on. For this exercise, select the highest level dimension from each group and click on OK to move forward. In the future you can use this functionality to restrict retrieved data/dimensions from larger cubes.
Specifying OLAP Rows and Columns
The Rows/Columns dialog screen enables you to select both the dimensions and fields to be presented along the columns and rows of the OLAP grid. The Dimensions list box depicted in Figure 16.4 lists all the available dimensions in the selected cube/data source.
Figure 16.4 The Rows/Columns dialog of the OLAP Report Creation Wizard.
To select a dimension for placement in the rows section or the columns section of the OLAP grid, highlight the desired dimension and click either the column or row arrow (>) button. It is possible to select multiple dimensions for display and to have them nested in the OLAP grid by successively selecting multiple dimensions for either the rows or the columns section. It is also possible to remove dimensions from the existing row or column list boxes; however, you cannot leave the column and row dimension list boxes empty.
After selecting the desired dimensions, you can select a subset of the fields (also known as members) for those dimensions by using the Select Row Members or Select Column Members button. Examples of this include selecting only a certain subset of provinces or states in a region dimension or, alternatively, selecting only a certain year's worth of data in a time dimension. By highlighting a dimension in either the Rows or the Columns list box and then selecting the appropriate selection button, you can use the Member Selector dialog to select a subset of the members for the involved dimension, as shown in Figure 16.5.
Figure 16.5 Use the Member Selector dialog to select default column and row dimension members.
The last and newest feature of the Rows/Column screen is the Create/Edit Parameter functionality provided for each of the row and column dimensions. This capability provides the business user or report consumer with the capability to interact with the report and control its content by entering parameters that directly affect the dimension members displayed in the OLAP grid(s) on the report.
Because Chapter 5, "Implementing Parameters for Dynamic Reporting," covered parameters in detail, you are familiar with this topic. Of significance for this wizard screen is that the parameter creation process is directly accessible here, and this facilitates the rapid development of formatted and interactive OLAP reports. If necessary, review Chapter 5 for a refresher on creating and editing parameters.
Continuing with the creation of the sample report started in the last section, the following steps walk through the Rows/Columns screen part of this report creation example and allow for the refinement of the data to be viewed in the OLAP grid. Follow these steps to add rows and columns to your OLAP-based report:
- Select the Stores dimension from the available dimensions list as the Row dimension using the row dimension arrow button. (Note: It will likely be necessary to remove a default dimension to ensure that this is the only dimension in the row dimensions list view.)
- Using the Select Row Members button, select all the store country locations (for example, Canada, USA, and Mexico) from the Member Selector dialog, but deselect the aggregated top-level All field. This enables the OLAP grid to present all the different store types down the side of the grid as rows.
- Select the Time dimension from the available dimensions list as the Column dimension using the column dimension arrow (>) button. (Note: It will likely be necessary to remove a default dimension to ensure that this is the only dimension in the column dimensions list view.)
- Using the Select Column Members button, select the quarters Q1, Q2, Q3, and Q4 from the year 1998 from the Member Selector dialog, but be sure not to select any children members. This enables the OLAP grid to present a comparison of the four quarters of data in four side-by-side columns.
- Click the Next button to proceed.
At this point, you will review the concept of OLAP dimension filters and pages in your OLAP report.
Specifying OLAP Dimension Slices (Filters) and Pages
The Slice/Page dialog of the OLAP Report Creation Wizard, shown in Figure 16.6, enables you to select values or members for the dimensions not selected to be row or column dimensions. In the OLAP world, these dimensions are paged or sliced dimensions.
Figure 16.6 The Slice/Page screen of the OLAP Report Creation Wizard allows manipulation of the dimensions not selected for use on either the rows or columns.
The Slice list box lists all the paged dimensions and their current member settings. The default setting is usually all members for any given dimension. An example is that for the Media Type Dimension, the default slice setting is All. To change the member selection (slice) for a particular dimension, that dimension must be selected in the Slice list box, and the Select Slice button must be used to open the familiar Member Selection dialog (refer to Figure 16.5). This dialog is identical to the Member Selector dialog used previously except that you can choose only one member from the selected dimension. If multiple members from a slice dimension are required in a report, use the Page list box and create separate pages/grids for each selected value.
The Page list box is initially empty but can contain any dimensions outside the row and column dimensions that require multiple member selection. An example could involve selecting the three countries of North America as store regions. The selection of multiple values for a paged dimension creates completely separate grids (based on the same preselected rows and columns) for each selected member value. To select multiple members for a dimension, select the involved dimension in the Slice list box and move it to the Page list box using the transfer arrow buttons between the list boxes. After you move the dimension to the Page list box, the Select Page Values button enables multiple member selection through the Member Selector dialog.
The last, but perhaps most powerful, feature of the Slice/Page screen is the Link to Parameter functionality provided for each of the filtered and paged dimensions. This capability provides the business user or report consumer with the capability to interact with the report and control its content by entering parameters that directly affect the information displayed in the OLAP grid(s) on the report.
Of significance for this wizard screen is that the parameter creation process is directly accessible here, which facilitates the rapid development of formatted and interactive OLAP reports.
For more information on creating and editing parameters, see "Creating and Implementing Parameters Fields," p. 134 |
Continuing with the creation of the sample report, the following steps walk through the Slice/Page dialog part of this report creation example and enable you to select the measure to display in the OLAP grid. Follow these steps to select measures on the page/slice dimensions:
- Select the Measures dimension from the Slice list box.
- Instead of selecting a specific filter using the Select Slice button, click the Link to Parameter Create/Edit button to enable the business user to dynamically select this slice every time the report runs. The Create Parameter Field dialog appears, as shown in Figure 16.7.
Figure 16.7 The Create Parameter Field dialog called from the Slice/Page screen.
- In the Prompting Text text box, enter the text that you want your user to be prompted with when this report runs. In this case, it could be something similar to Please select the measure to be used in your report. Also, ensure that the Discrete Value(s) radio button is active because a range of entries is not required or allowed here.
- To avoid requiring users to type in any text, defaults can be set so that selection from a drop-down box is possible. To do this, click the Default Values button. The dialog in Figure 16.8 appears.
Figure 16.8 The Set Default Values dialog for the OLAP slice parameter.
- The Measures table is preselected because the report respects the association with the previously highlighted dimension. Move all the available member values for the Measures dimension to the Description list box by clicking on the Select Default Values button and selecting all the members through the familiar Member Selector dialog.
- Ensure that the Display drop-down box has Description selected and that the Order drop-down box has no sort selected. Click on OK twice to get back to the Slice/Page dialog of the OLAP Report Creation Wizard.
- When you return to the Slice/Page dialog, highlight the Products dimension in the Slice list box, and click on the arrow transfer/select button to move it to the Page list box. The Member Selection dialog immediately appears with the Products Dimension Hierarchy presented.
- Select the Food and Drink Product types (two of the children of All Products), and deselect the All Products field. Individual OLAP grids are created for each of the drink products and the food products. If this isn't clear now, it should make more sense when you visualize the report.
- Click on OK and then Next to proceed.
Adding Report Styles in the OLAP Report Creation Wizard
The Style dialog in the OLAP Report Creation Wizard enables you to select any one of a predetermined number of styles for OLAP grids available in Crystal Reports. Figure 16.9 displays the Style dialog. The styles are a good starting point for formatting the OLAP grids on your reports. You can enhance them through the Customize Style tab of the OLAP Expert (described later in the chapter) and by using many of the advanced formatting features you have already learned about.
Figure 16.9 The Style dialog of the OLAP Report Creation Wizard.
Adding Charts via the OLAP Report Creation Wizard
The Chart dialog provided in the OLAP Report Creation Wizard enables you to quickly add graphics to the OLAP report being created. The graphics available in the wizard, shown in Figure 16.10, are only a subset of the graphics available in Crystal Reports (see Chapter 8, "Visualizing Your Data with Charts and Maps," for a refresher), but they enable a rapid visualization of your OLAP data without using the Chart Expert.
Figure 16.10 The Chart dialog of the OLAP Report Creation Wizard enables you to select between different basic chart types.
Aside from selecting the type of chart (bar, line, or pie) and specifying a title on this screen, you must specify an On Change Of field with an optional Subdivided By field before this screen is complete. As Chapter 8 discussed, On Change Of is the data source field that provides the breaking point for the involved graphic. Examples could include country, region, year, store, product, and so on. The Subdivided By field can provide a second variable to base your charts on. An example of a two-variable OLAP chart using the FoodMart sample cube is a chart showing salary information by year and then subdivided by store type.
To complete the OLAP report creation process, the following steps take you through the addition of a style, a chart, and the creation of the finished report:
- On the Style dialog, select any style that suits your preference, and click on the Next button.
- On the Chart dialog, select Pie Chart as the chart type by selecting the associated radio button. This provides a nice way of visualizing comparables across different store types.
- Give your chart a title similar to Measures by Store Country and Time by entering it in the Chart Title text box.
- Select all grid column fields as the On Change Of field. This facilitates the comparison of the three store locales. Select all the grid row fields as the Subdivided By drop-down selection.
- Click on the Finish button on the OLAP Report Creation Wizard. The wizard prompts you to select a parameter for the Measure dimension. After you select Store Sales (or another field if you prefer), the wizard generates a report that looks similar to Figure 16.11.
Figure 16.11 The sample OLAP report created using the OLAP Report Creation Wizard.
The OLAP Report Creation Wizard provides an efficient and effective method to getting value out of OLAP data in a short time. After placing an OLAP grid or OLAP chart on your report through the wizard, you can perform further formatting and analysis through a variety of built-in Crystal Reports formatting tools. The next two sections explore further customization options, and the three subsequent sections discuss the powerful interactivity available in Crystal Reports OLAP objects.
Customizing Styles in the OLAP Expert
After an OLAP grid has been added to a report, with or without a selected style, Crystal Reports provides the capability to enhance and customize the formatting of that grid through the Customize Style tab of the OLAP Expert. Figure 16.12 shows the OLAP Expert dialog, which you access by right-clicking on an existing OLAP grid object and selecting OLAP Grid Expert or by selecting the Insert OLAP Grid option from the Insert menu.
Figure 16.12 The OLAP Expert dialog provides the capability to edit many OLAP grid display properties including the customization of styles.
Four of the tabs in the OLAP Expert have identical functionality to that presented in the previous OLAP Report Creation Wizard sections. The Customize Style tab shown in Figure 16.12 is unique to the OLAP Expert and provides the capability to fine-tune the formatting of the row and column dimensions selected for the involved OLAP grid. By selecting any of the column or row dimensions from the presented list boxes, you can select custom colors for the backgrounds of the OLAP grid row and column headings. The Customize Style tab offers a number of formatting options for the presentation of the grid, including indentation, blank column/row suppression, margins, and labels. Also provided is an option to format grid lines, as shown in Figure 16.13. This dialog enables granular level formatting and selection of grid lines for display on the OLAP grid's layout.
Figure 16.13 The Format Grid Lines dialog is accessed from the Customize Style tab of the OLAP Expert dialog and enables granular-level control of the grid lines in the OLAP grid.
Customizing Labels in the OLAP Expert
The Labels tab of the OLAP Expert, shown in Figure 16.14, provides the capability to customize the display of the paged dimension (non-row/column dimensions) labels on the OLAP grid.
Figure 16.14 The Labels tab of the OLAP Expert enables you to specify display properties around the OLAP grid's dimensions.
Paged/sliced dimension member values for the display grid can be displayed or hidden by simply moving the selected dimension between the unlabeled dimension and labeled dimension list boxes using the transfer arrow (>, >>, <, <<) buttons. You can select additional labeling options such as label location, label spacing, and dimension names in this tab.