You are on page 1of 22

1: Working with Filters

:
The Vice President of Sales has requested a report that shows sales performance by representatives in each country for 2002. He would also like to see the performance for representatives in Northern Europe in order to present an award to the top seller when he visits next month.

Task 1. View the initial report. 1. With Report Studio still open, on the toolbar, click Open 2. In the Open dialog box, click Demo 3-1, and then click Open. The sales rep report appears in the work area. We need to filter the report to only show data from 2002. 3. Run the report. 4. Click Bottom to view the last page of the report, and then scroll to the bottom of the page. We can see that total revenue for all years is $171,576,387.88. 5. Click Close to return to Report Studio. Task 2. Add a filter to show sales from only 2002. 1. On the toolbar, click Filters The Filters(Query1) dialog box appears. Notice there are two tabs: one for creating filters at the table level, and one for creating filters at the grouped level. 2. Under the Tabular Filters pane, click Add to add a new filter.

The Tabular Model Filter expression editor appears. 3. In the Available Components pane, ensure Orders is expanded, and then double-click Order date to add it to the filter expression. The Order date query item appears in the Expression Definition pane. Notice that it also shows the namespace name (which in this case is the same as the model name) and query subject that contains this item. 4. Click inside the Expression Definition pane to place your cursor at

the end of the expression, and then type between 2002-01-01 and 2002-12-31. The result appears as shown below: 5. Click Validate 6. Click OK. , to check the expression for errors.

A message appears in the Information pane saying there are no errors.

Task 3. Filter data to show only Northern European countries. Note: The Northern European countries in which we operate are Sweden, Finland, and the Netherlands. 1. Click Close, and then on the toolbar, click Filters. The Filters (Sales Representative Performance Report) dialog box appears showing the Tabular filter we just created. Since Country is a query item already on our report and is a grouped item, we will create the Country filter at the group level. 2. Click the Group Filters tab, and then click Add. The Group Filter dialog box appears. The Available Components pane shows grouped items at the top, followed by items that are not grouped. 3. In the Available Components pane, double-click the Country item to add it to the expression. 4. Click inside the Expression Definition pane to place your cursor at the end of the expression, and then type in ('Netherlands', 'Sweden', 'Finland'). 4. Click OK and run the report.

Demo 4-2: Link a Sales Report to a Contact Information

DRILL THROUGH REPORT
Task 1. Change the Last name item to display full name. 1. In the work area, click the Last name column to select it. 2. In the Properties pane under Data Item, click Expression, and then click the Ellipsis. The Tabular Model Data Item dialog box appears as shown below:

The Expression Definition pane shows the query expression for Last name, including where it is found, and how it will be displayed. We will edit this expression to display the last name followed by the first name, separated by a comma, such as Smith, Joe. 3. Click inside the Expression Definition pane so the cursor appears at the end of the expression (after [Last name]), and type, +', '+ and ensure that you enter a space after the comma between the single quotes. 4. In the Available Components pane, expand the Sales reps query subject, and then double-click First name to add it to the expression. The query expression definition now appears as follows:

5. Click OK.

6. In the Properties pane, under Fact Item, click the cell to the right of Alias, type Name, and then press Enter. Notice that the Last name column in the work area is now called Name. Since the Name column will display both the last and first names of each rep, we can remove the now redundant First name column. 7. In the work area, click the First name column, and then press Delete. Now we will add a parameter to this report to show contact information only for specified sales reps. Task 3. Add a Name parameter to the report. 1. On the toolbar, click Filters. 2. In the Filters(Query1) dialog box, click the Group Filters tab, and then click Add. The Name item does not exist in the database, only on our report, so we use the Group Filters tab to create a filter using items on our report. We want to create the expression Name=?Name? so the report will display data for only the representative we select. 3. In the Available Components pane, double-click Name to add it to the expression. 4. With the cursor already at the end of the expression, type =?Name? The report will only show the contact information for specified reps. 5. Click OK, and then click OK again. 6. Save the report as Demo 4-2a. Task 4. Alter the Sales Rep Performance report to show all countries and revenue over $1,000,000. 1. Open Demo 4-1. 2. On the toolbar, click Filters, and then click the Group Filters tab. 3. Click the Country filter, and then in the Usage box, click Disabled. For this report, we want to see all countries. 4. Click the Tabular Filters tab. We want to keep the Order date filter to show only sales from 2002 and we want to add a filter to show total revenue greater than $1,000,000. 5. Click Add, to create a new Revenue filter. 6. In the Available Components pane under Orders, double-click Revenue to add it to the expression. 7. Click inside the Expression Definition pane so the cursor appears at the end of the expression, type >1000000, and then click OK. 8. In the Filters(Query1) dialog box, under Application, click After Aggregation, and then click OK. We want to see results for total sales per rep that exceed $1,000,000, not individual sales greater than $1,000,000.
.

Task 5. Change the Last name item to display full name, and dd a drill-through connection to the contact information report. 1. Repeat Task 2 to display the Last name item as Name, and remove the First name column. 2. In the work area, click the Name column, and then on the toolbar, click Drill Throughs 3. In the Drill Throughs dialog box, click New Drill Through 4. Under Target Report, click the Ellipsis, click Demo 4-2a, and then click Open. A message appears saying one parameter has been added. 5. Click OK, to close the message. 6. Click the Open in a new window check box, and then click OK. The Name items now appear as hyperlinks with a plus sign beside them. 7. Run the report. The report appears as shown below, with names as links:

8. Click Cartel, Jake. The Contact Information report opens in a new window showing the contact information for Jake Cartel.

9. Close both Report Viewer windows, and then save the report as Demo 4-2b.

DO it Yourself: Activity

shop 4-2: Create a Drill-through Connection to Link Two Reports
We have been asked to create a list report that contains the mailing addresses of each city and the sales representatives that work in each city. In order to make this information easily accessible, we will link this report to the Sales Representatives Performance report to show mailing addresses by individual city. To accomplish this we will:  Create a new List report containing the following items:   First name  Last name  Address line 1  Address line 2  City  Region  Postal Zone  Country  Add a City parameter to the report and save the report as  Wkshp 4-2a.  Open the most recent Sales Representative Performance report  (Demo 4-2b).  Create a drill through connection to the Mailing Addresses  report from the City column.  Run the report and click Melbourne to view the sales  representatives and mailing address for that city.  Save the report as Wkshp 4-2b. 

CREAT E

AND

USE

PROMPTS

Demo 5-1: Create a Prompt by Adding a Parameter
Purpose: We have been asked to provide a report showing product sales by order date to determine the revenue generated by each individual order for the Year 2002. Because the report contains detailed information we want to be able to filter the report to only show orders made after a specified date. Task 1. Add items to a list report. 1. Create a new List report. 2. In the Insertable Objects pane, ensure the Orders query subject is expanded, and then double-click Order number and Order date to add them to the report. 3. Ensure the Products query subject is expanded, and then double-click Product name to add it to the report. 4. Under the Orders query subject, double-click Revenue to add it to the report. Task 2. Sort ascending on the Order date column and run the report. 1. In the work area, click the Order date column. 2. On the toolbar, click Sort, and then click Sort Ascending. 3. Run the report. The results appear as shown below:

Notice that the earliest date is Jan 2, 2000. 4. Click Bottom to see the last page of the report. Notice that the last date is Dec 24, 2002. 5. Click Close to return to Report Studio.

Task 3. Add an Order date parameter and run the report. 1. On the toolbar, click Filters.

2. In the Filters(Query1) dialog box, click Add. 3. In the Tabular Model Filter dialog box, under Available Components, expand Orders, and then double-click Order date. 4. In the Expression Definition pane, to the right of [Order date], type >?Date?. The expression definition appears as shown below:

The report will only retrieve and display data for transactions where the order date is greater than (or later than) the date specified by the user. 5. Click OK, and then click OK again to close the Filters(Query1) dialog box. 6. Run the report. The Report Viewer appears prompting to select a date and time. 7. Select 2002-Jan-1, leave the time as 12 a.m., and then click OK. The results appear as shown below: 8. Click Bottom to see the last page of the report. We can see that our report displays results from Jan 3, 2002 to Dec 24, 2002. 9. Click Close to return to Report Studio, and then save the report as Demo 5-1. 10. Leave Report Studio open for the next demo.

ADD a Prompt Page to a Report
Task 1. Create a production cost list report. 1. Create a new List report. 2. In the Insertable Objects pane, ensure the Products query subject is expanded and then double-click Product line, Product type, Product name, and Production cost to add them to the report. Task 2. Format Production cost for currency. 1. In the work area, click the Production cost column. 2. In the Properties pane, click Data Format, and then click the Ellipsis. The Data Format dialog box appears. 3. In the drop-down list under Format type, click Currency. 4. Under Properties, click Currency, and then from the drop-down list to the right of Currency, click $ (USD) United States of America dollar. Revenue will now be displayed as American currency. 5. Click OK. We now need to add a prompt page to our report so that users can select the product line, type, and name to report on. In order to simplify the selection process, we will create cascading prompts so that once a Product Line is chosen, only the product types in that line will be available in the following prompt. Likewise, once a Product type is chosen, only Product names in that type will be available.

Task 3. Build the prompt page. 1. In the work area, Ctrl+click the Product line, Product type, and Product name columns, and then on the toolbar, click Build Prompt Page The following prompt page appears in the work area:

Notice the Cancel, Back, Next, and Finish buttons at the bottom of the work area. These buttons will appear on the prompt page so the user can navigate between pages, submit selections, or cancel the report and return to Report Studio. 2. In the work area, click inside the Product name box. 3. In the Properties pane under General, click the cell to the right of Cascade Source, and then click the Ellipsis. The Cascading Source dialog box appears. 4. In the Cascade Source dialog box, from the drop-down list, click Product type, and then click OK. The Product name choices available to choose from will now depend on the Product type selected. 5. Repeat steps 2 to 4 to set the Cascade Source property for the Product type prompt to Product line.

Task 4. Set behavior patterns for prompts. 1. With the Product type prompt still selected, in the Properties pane, click the

cell to the right of Multi-Select, and then in the drop-down list click No. 2. Click the cell to the right of Auto-Submit, and then in the drop-down list click Yes. The user can only select one product type, and the selection will be submitted automatically. 3. In the work area, click inside the Product line box, and then repeat steps 1 and 2 to set Multi-Select to No, and Auto-Submit to Yes. 4. In the work area, click inside the Product name box, and in the Properties pane, ensure that Multi-Select is Yes and Auto-Submit is No. The user can select multiple product names, but the selection will not be submitted automatically. Once all of the prompts are answered, the user must submit the request manually by clicking the Finish button. Task 5. Run the report. 1. Run the report. 2. Under Product line, click Camping Equipment. Notice that the Product type prompt is now populated with values. This is because the Auto-Submit property submitted the Product line value as soon as it was clicked. 3. Under Product type, click Cooking Gear. The Product name prompt now displays all products in Cooking Gear: Unlike the previous two prompts, this one allows for more than one selection, as indicated by the Select all and Deselect all links at the bottom of the prompt. 4. Under Product name, click Select All, and then click Finish. The results appear as shown below: 5. Click Close to return to Report Studio, and then save the report as Demo 5-2. 6. Leave Report Studio open for the next Workshop.

.

Demo 6-1: Create a Complex Report
Purpose: We have been asked by the Vice President of Sales to provide a report showing the quantity sold, revenue and gross profit on all products and related ordering information. To do this, we will include a list, chart, and crosstab in the same report each reporting on a different measure. We will also add a header to the report to explain its content. Task 1. Add items to a list report. 1. Create a new Blank report. 2. In the Insertable Objects pane, click the Toolbox tab, and then drag and drop a Table onto the work area. The Insert Table dialog box appears. 3. Leave the number of columns and rows as 2 and 1 respectively, and click OK. A two-cell table appears at the top of the work area. 4. Drag and drop a List into the left cell of the table. The Create-List dialog box appears. 5. Under Based on, with New query selected, type List to name the query, and then click OK. The results appear as shown below:

Notice that the list does not take up the entire left table cell. The space to the right of the list is still part of the left table cell. The right table cell is the thin cell on the far right. 6. Drag and drop a Chart into the right cell of the table. 7. Name the new query Chart, and then click OK. 8. In the Insert Chart dialog box, accept the default setting of a column chart, and then click OK. 9. Drag and drop a Crosstab to the right of the table to place it below the table.

10. Name the new query Crosstab, and then click OK. The results appear as follows:

We can now add query items to each of the report objects. Task 2. Add Items to the report objects. 1. In the Insertable Objects pane, click the Model tab, expand Orders, and then drag and drop Order number onto the first column of the list when a flashing black bar appears as shown below:

2. Double-click Order date to add it to the list. 3. Expand Products, double-click Product name, and under Orders double-click Quantity to add them to the list. 4. On the Chart, drag and drop Revenue onto Measures, Product Line onto Categories, and Order method onto Series. 5. On the Crosstab, drag and drop Product type onto rows, Order method onto Columns, and Gross profit onto Measures. The results appear as follows:

6. Run the report. A large report appears in Report Viewer showing the chart to the right of the list, and a crosstab at the bottom. We will now add a header to provide users with information about the report. Task 3. Add a header to the report. 1. Click Close, and then on the toolbar click Page Header & Footer 2. In the Page Header & Footer dialog box, click the check box beside Header, and then click OK. A blank header appears at the top of the work area underlined with a red dotted line. 3. From the Toolbox tab of the Insertable Objects pane, drag and drop a Block into the header. 4. Drag and drop another Block into the header, to the right of the first block, when a thin black line appears to the right of the first block. The results appear as shown below: 5. Drag and drop a Text Item onto the top header block. 6. In the Text dialog box, type Product Report, and then click OK. 7. Repeat steps 5 and 6 to add a text item to the bottom block reading, Product Orders by Quantity, Revenue, and Gross Profit. Task 4. Apply style to the header. 1. Click Product Report in the header, and then on the toolbar click Font. Ensure you select only the text item, and not the whole block. 2. In the Font dialog box, click Arial Black and 20pt, and then set the Foreground color to Red. 3. Click Apply to see the new font settings, and then click OK. 4. On the toolbar, click Container Alignment, and then click Align Top Center 5. Format the text item in the bottom block to be Arial, 14pt, and italics, with a Foreground color of Red. 6. Align the text item in the bottom block to be Align Top Center. 7. Run the report. The header appears at the top center of the report. 8. Click Close, and then save the report as Demo 6-1. 9. Leave Report Studio open for the next demo.

Demo 6-2: Show the Same Data Graphically and Numerically
Purpose: The Vice President of Sales would like to see Product Line Sales by Order Type information in both a graphical and numeric display. To do this, we will open the existing report containing a Chart and add a crosstab that reports on the same information. The header of the report needs to show the report name and an image for visual interest. Task 1. Add a crosstab to the report. 1. Open Demo 3-3. 2. In the Insertable Objects pane, click the Toolbox tab, and then drag and drop a Crosstab to the right of the chart to place it below the chart. 3. In the Create - Crosstab dialog box, click the radio button beside Existing query to select it. Under Existing query, Query1 appears in the drop-down list. Because Query1 is the only query in this report, this is the only choice. If there were multiple queries in the report, you would choose which query you wanted to use to populate the new report object. 4. Click OK. A crosstab appears below the chart containing the same query items as the chart. The results appear as shown below:

Task 2. Customize the page header. 1. At the top of the chart, click the chart title that reads Product Line Sales by Order Method. 2. In the Properties pane, beside Display, change the setting from Show to Hide. The chart title in the work area is removed and replaced with a generic placeholder stating the title is hidden. 3. In the work area, click the area around the header text so that the block in the header is selected, and then press Delete. 4. Drag and drop a Table into the header, with 2 columns and 1 row. 5. Drag and drop a Text Item into the left table cell, type Product Line Sales by Order Method, and then click OK.

6. Drag and drop an Image into the right table cell. The header appears as shown below: 7. Click the text in the left table cell, and then click Font. 8. Change the font to Arial Black, 12pt, with Navy Foreground Color, and then click OK. 9. Click the Image in the right table cell, in the Properties pane, click URL, and then click the Ellipsis. 10. In the Image URL dialog box, click Browse, click cube.gif, and then click OK twice. A spinning cube appears in the right side of the header. 11. Run the Report. The report appears with a chart depicting the same data that is displayed below in the crosstab. If we scroll down we can see the date and time that the report was generated and the current page number. If we scroll to the right we can see the cube image in the header. We will move the image to the left so it can be seen as soon as the report is generated. Task 4. Pad a table cell and view without boundary lines. 1. Click Close to return to Report Studio. 2. Click the right table cell containing the cube, but not the cube itself. 3. In the Properties pane under Box, click Padding, and then click the Ellipsis. 4. In the Padding dialog box, type 500 in the box on the right, and then click OK. The cube is pushed to the left because we added 500 pixels to the right side of the cell. 5. On the toolbar, click Boundary Lines 6. Run the report. to remove the grid lines.

The cube is now visible as soon as the report appears. 7. Click Close, and then save the report as Demo 6-2. 8. Keep Demo 6-2 open for the next demo.

Demo 6-3: Add Pages and Parameter Values to a Report
Purpose: We have been asked to add a cover page to the Product Line Sales by Order Type report and include a prompt page to allow users to report on specific countries. We will add a cover page that will appear before the first report page, and will include a calculation showing the countries used in the report based on the countries selected on the prompt page. Task 1. Add a prompt page to select Countries. 1. With Demo 6-2 still open, click Boundary Lines to view the lines. 2. On the toolbar, click Build Prompt Page. The work area appears with a header at the top and prompt buttons at the bottom. 3. In the Insertable Objects pane, click the Toolbox tab, and then drag and drop a Value Prompt onto the work area. The Prompt Wizard appears. 4. Under the Create a new parameter box, change the name from Parameter1 to Country, and then click Next. 5. To the right of Model item, click the Ellipsis. 6. In the Choose Model Item dialog box, expand Sales branch address, click Country, and then click OK. 7. In the drop-down list beside Operator, click in. 8. Click the check box beside Make the filter optional to select it, and then click Next. 9. Name the query Country_Prompt, and then click Finish. The Country prompt appears in the top left corner of the work area. 10. Click inside the Prompt box in the work area, and ensure in the Properties pane that the Multi-Select option is set to Yes, and that Auto-Submit is set to No. Task 2. Include parameter information on the report. 1. On the vertical Explorer toolbar, point to Page Explorer Report Pages, click Page1. , and then under

The work area changes from displaying the prompt page to the chart and crosstab report.

2. In the Insertable Objects pane, ensure the Toolbox tab is selected, and then drag and drop a Block to the right of the cell containing the cube in the header. A block appears under the text and image in the header as shown below:

3. Drag and drop a Calculation into the block. The Create Calculation dialog box appears. 4. In the Name box, type Country, in the Type box, click Layout, and then click OK. We chose a Layout calculation because the calculation pertains to information about the report (the countries selected on the prompt page), not on data from the database. The Expression Editor appears. 5. Click the Parameters tab. The Available Components pane shows all of the parameters in this report. This report has only one parameter. 6. In the Available Components pane, double-click Country to add it to the expression. The results appear as shown below:

7. Click OK. The report expression <%ParamDisplay%> appears below the text in the header. This will display the countries included in the report based on the user's selection on the prompt page.

Task 3. Add a cover page to the report. 1. From the File menu, click Pages. The Pages dialog box appears showing the one report page in the report. 2. With the Report Pages tab selected, click Add 3. In the Add dialog box, type Cover Page, and then click OK. 4. With Cover Page selected, click Move Up the report page, and then click OK. , to move this new page ahead of

The work area displays the new Cover Page as a blank page. We will add text and an image to this page. Task 4. Design the cover page. 1. Drag and drop a Table onto the work area with 1 column and 3 rows. 2. Drag and drop a Text Item into the top table cell that reads Great Outdoors. 3. Drag and drop a Text Item into the bottom table cell that reads Sales Report. 4. Ctrl+click the Great Outdoors and the Sales Report text items only (not the entire cells), and then click Font. 5. Click Arial Black, click 20 pt, change the Foreground Color to Navy, and then click OK. 6. Drag and drop an Image into the middle table cell. 7. Click the Image, then in the Properties pane, click URL, and then click the Ellipsis. 8. In the Image URL dialog box, click Browse, click cover1.jpg, and then click OK. 9. Click OK again. 10. With the image still selected in the work area, click Container Alignment, and then click Align Middle Center 11. Position the Great Outdoors and the Sales Report text items so they are also aligned middle center. Task 5. Run the report. 1. Run the report. The Prompt Page appears. 2. Shift+click France and Italy to select France, Germany, and Italy, and then click Finish. The cover page of the report appears.

3. Click Page down to see the next page of the report. The report appears showing the countries we selected above the chart. The results appear as shown below:

4. Click Close, save the report as Demo 6-3, and then leave Report Studio open for the workshops.