Using the Query Builder

This lesson teaches you how to use the Query Builder to modify the layout of presentations, and selections for the data that is displayed in crosstabs and graphs.

Overview Topics

Overview
Prerequisites

Topics

This lesson will discuss the following:

Modify the Layout of a Crosstab

Select Dimension Members

Create Saved Selections
Modify the Layout of a Graph
Use Saved Selections and Dimension Conditions
Summary

45 minutes

Move your mouse over this icon to show all screenshots. You can also move your mouse over each individual icon to see only the screenshot associated with it.

 

Overview

The Query Builder provides a simple user interface to define sophisticated queries. A key strength of the Query Builder is that the end-user does not need to know a query language to define the query.

Back to Topic List

Lesson Objectives

In this lesson, you will learn how to create powerful analytic queries that are made simple by presenting the query definition in business terms. End users can easliy modify these queries to meet their needs using the same simple interface.

You will use the Query Builder to modify the layout and selections for the data that appears in a crosstab and a graph. Specifically, you will learn how to:

Select Query Items

The Query Builder presents the available measures for query in a format that is identical to the Items step of the Presentation Wizard. You can use this interface to add and remove query items for a presentation at any time.

Move your mouse over this icon to see the image

 

Modify the Query Layout

The Query Builder provides a graphical layout tool that lets you modify the layout of your query for a Crosstab or a Graph.

 

Specify Dimension Selections

The Query Builder provides three ways to specify selections for the dimensions in a query:

Members

The Members tab provides an ad hoc method of adding and removing specified dimension members to affect the current selection.

Move your mouse over this icon to see the image

 

Conditions

The Query Builder supports all of the conditional functions that business intelligence users are accustomed to, such as ranking and exception tools. Other selection tools include level selections, selection by attribute, hierarchical selections, and time-based selections.

For example, a default query definition can be “Show the Top 5 Products based on Sales”. An end-user can then modify the word “Top” to “Bottom” in the definition to show the bottom 5 products based on sales.

Move your mouse over this icon to see the image

 

Saved Selections

The Query Builder also makes it easy to reuse selections by allowing users to save and retrieve defined selections. Users often want to use a popular selection or query (such as “Top 5 Products” or "Last 3 Months") in multiple reports or presentations.

Move your mouse over this icon to see the image

 

The Query Builder also has two tabs that reveal the contents of the current dimension selection before you execute the query:

Steps

The Steps tab organizes the current selection based on the criteria that comprises the query. The criteria can be a combination of any of the following: members, conditions, and saved selection steps.

 

Members

The Members tab shows the result of the current set of selection steps.

For example, the Members tab shown here displays a preview of the dimension members that would be returned from the "Top 5 Products" condition shown previously.

Move your mouse over this icon to see the image

 

Data Model

For information on the data model used in the BI Beans OBE lessons, please see the Data Model page.

High Level Objectives

The general business requirements of the BI Beans OBE lessons are described in the Business Requirements page.

 

Back to Topic List

In order for this lesson to work successfully, you will need to have performed the following:

1.

Complete the lesson titled 'Creating Business Intelligence (BI) Objects'

 

 

Modify the Layout of a Crosstab

You can change the layout of the dimensions in a crosstab by using the Query Builder.

Back to Topic List

Perform the following steps to change the layout of the dimensions in the Sales Analysis crosstab:

1.

If the crosstab that you defined in the previous lesson is not already open, in the Applications-Navigator pane, right-click Sales Analysis Crosstab and click Open.

Move your mouse over this icon to see the image

 

2.

On the toolbar in the upper left corner of the crosstab, click the Query Editor tool.

Move your mouse over this icon to see the image

The Query Editor tool launches the re-entrant Query Wizard.

 

3.

In the Query Wizard, select the Layout tab.

Move your mouse over this icon to see the image

Note: The Layout tab that is contained within the re-entrant Query Wizard is also represented as a Step in the Presentation Wizard. In the previous lesson, the instructions for creating your crosstab and graph did not include steps that demonstrated this Query Builder feature. Therefore, you can also specify the layout of a presentation object when you first create that object.

 

4.

To rearrange dimensions, select a dimension, and use a drag-and-drop operation to move the dimension to the desired position.

Rearrange the dimensions so that the layout appears as follows:

Page Items: Promotion, Channel, Time
Row dimension (on the left): Geography
Column dimensions: Measure below Product

Move your mouse over this icon to see the image

Click OK to to apply the changes and exit the wizard.

 

5.

Observe that the layout of the crosstab has changed.

Move your mouse over this icon to see the image

From the File menu, select Save All to save your work.

 

 

Select Dimension Members

As stated in the Overview section, you can modify dimension selections in an ad-hoc fashion by selecting from a list of available dimension members.

Here, you will use this method to modify the selections for the data that appears in your crosstab in order to show the Sales Revenue for the sub regions and countries of Americas, at the Product Division level, for All Channels of distribution.

Back to Topic List

Follow these steps to modify the dimension selections for the Geography, Channel, and Product dimensions:

Change the Geography Selection
Change the Product Selection


Change the Geography Selection

Back to Subtopic List

To change the Geography selection to the sub-regions and countries within Americas, perform the following steps:

1. Click the Query Editor tool on the toolbar of the Sales Analysis Crosstab.

Move your mouse over this icon to see the image

The re-entrant Query Wizard is opened.

 

2.

In the Query Wizard, select the Dimensions tab.

Move your mouse over this icon to see the image

Note: The Dimensions tabs that is contained within the re-entrant Query Wizard is also represented as Steps in the Presentation Wizard. In the previous lesson, the instructions for creating your crosstab and graph did not include steps that demonstrated this Query Builder feature. Therefore, you can also specify the dimension selections for a presentation object when you first create that object.

 

3.

In the Choose box, select Geography.

Move your mouse over this icon to see the image

Click the Remove All Items shuttle button ('<<') to remove the current selection.


4.

In the Available list, select the Members tab and click the drill symbol ('+'), which is located to the left of World total, then again click the drill symbol ('+') to expand Americas. The list of sub-regions appears.

Click the drill symbol ('+') located to the left of Northern America and Southern America to display the countries associated with each sub-region.

Using the mouse and the 'Shift' key, multi-select the following Geography dimension members: 'Americas', 'Northern America', 'Canada', 'United States of America', 'Southern America', 'Argentina' and 'Brazil'.

Move your mouse over this icon to see the image


5.

Click the Add Selected Items shuttle button ('>') to move Americas group to the Selected List.

Move your mouse over this icon to see the image

Click Apply to apply the changes. Do not exit the Query Wizard.

 

 

Change the Channel Selection

Back to Subtopic List

To modify the Channel selection to include all channels of distribution, perform the following steps:

1.

Ensure that the Dimensions tab is selected in the Query Wizard. In the Choose box, select Channel..

Move your mouse over this icon to see the image

Click the Remove All Items shuttle button ('<<') to remove the current selection.


2.

In the Available list, click the drill symbol ('+'), which is located to the left of Channel total. Then, click on the Add all Items shuttle button ('>>') to move all of the channels to the Selected list.

Move your mouse over this icon to see the image

Click Apply to apply the changes. Do not exit the Query Wizard.


 

Change the Product Selection

Back to Subtopic List

To change the Product selection to Total Products and the Products Divisions, perform the following steps:

1.

Ensure that the Dimensions tab is selected in the Query Wizard. In the Choose box, select Product.

Move your mouse over this icon to see the image

Click the Remove All Items shuttle button ('<<') to remove the current selection.


2.

In the Available list, select Product total. Click the Add Selected Items shuttle button ('>') to move Product total to the Selected list.

Move your mouse over this icon to see the image


3.

In the Selected list, select Product total. Click the drill symbol ('+') to expand Product total. The list of product categories appears.

Move your mouse over this icon to see the image

Click OK to apply the changes and exit the Query wizard.

The crosstab should display in the following format:

Move your mouse over this icon to see the image

 

4 .

From the File menu, click Save All to save your work.

 

 

Create Saved Selections

As stated in the Overview section, you can save defined dimension selections. These saved selections can then be reused in other queries.

Back to Topic List

In this topic, you will create two saved selections for the Geography dimension that will be used later in these lessons.

To create the saved selections for the Geography dimension, follow these steps:

1.

Click the Query Editor tool on the toolbar of the Sales Analysis Crosstab.

 

2.

In the Query Wizard, click the Dimensions tab and select Geography in the Choose box. The current selection for Geography dimension is displayed in the Selected region.

Move your mouse over this icon to see the image

 

3.

Click the Save button at the bottom of the Selected region. The Save Selection As dialog box is displayed.

 

4.

In the Save Selection As dialog box, enter America Areas as the name.

Move your mouse over this icon to see the image

Accept the default Save steps option and click OK to return to the Query Wizard.

Notes:

Saved steps: The "Save steps" option creates an XML object that records the steps that result in the dimension selection. This object can be thought of as a dynamic saved selection. For example, if you create a saved selection that contains a condition, you should choose this option. Each time the query is run, this kind of saved selection is re-evaluated using the current state of the dimension.

Saved members: The "Save members" option creates an XML object that records a static list of values that are specified for the dimension when the saved selection is created. Therefore, this object contains a list of dimension members that never change.

 

5.

Now, still in the Query Wizard's Dimension tab, create a second regional selection for European Regional members by following these steps:

A. Click Remove All Items ("<<") to clear the Selected list.
B. In the Available list, select the Members tab and click the drill symbol ('+'), which is located to the left of World total, then again click the drill symbol ('+') to expand Europe. The list of sub-regions appears.
C.

Multi-select the following Geography dimension members: 'Europe', 'Eastern Europe', and 'Western Europe'. Then, click Add Selectedl Items (">").

D.

In the Steps tab of the Selected region, drill on 'Eastern Europe', and 'Western Europe' to display their countries:

Move your mouse over this icon to see the image

 

E. Click the Save button at the bottom of the Selected region.
F. In the Save Selection As dialog box, enter European Areas as the name and click OK to return to the Query Wizard.

The new saved selections are ready for reuse.

 

6.

Use America Areas as the default selection for the crosstab. To do this:

A. Click Remove All Items ("<<") to clear the Selected list.
B. In the Available region, choose the Saved Selections tab to view the new saved selections.
C.

Choose Ameria Areas and click Add Selectedl Items (">").

Move your mouse over this icon to see the image

To preview the members that will be returned by a saved selection, click the Members tab in the Selected region.

Move your mouse over this icon to see the image

 

7.

Click OK to close the Query Wizard.

 

8.

From the File menu, select Save All to save your work. Then, close the crosstab.

 

 

Modify the Layout of a Graph

You can change the layout of the dimensions in a graph by using the Query Builder.

Back to Topic List

Use the following steps to change the layout of the dimensions that are displayed in the Sales Analysis graph so that the bars of the graph represent Product, and they are grouped by Channel.

1.

If the graph that you defined in the previous lesson is not already open, right-click Sales Analysis Graph and click Open.

Move your mouse over this icon to see the image

 

2.

In the toolbar of the Sales Analysis Graph, click the Query Editor tool.

Move your mouse over this icon to see the image

The re-entrant Query Wizard is opened.


3.

In the Query Wizard, select the Layout tab.

Move your mouse over this icon to see the image

 

4.

To rearrange dimensions, select a dimension, and use a drag-and-drop operation to move the dimension to the desired position. Rearrange the dimensions so that the layout appears as follows:

Page Items: Geography, Promotion, Time, Measure
Bars: Product
Groups: Channel

Move your mouse over this icon to see the image

Click OK to to apply the changes and exit the wizard. The modified layout of the graph is shown here:

Move your mouse over this icon to see the image

 

4.

From the File menu, select Save All to save your work.

 

 

Use Saved Selections and Dimension Conditions

As stated in the Overview section, you can modify the data selections in a presentation by using Saved Selections and creating Dimension Conditions.

For the Sales Analysis graph, you will modify the Geography dimension by using a Saved Selection that you created previously. In addition, you will create a ranking condition that returns the top 5 products in the Photo division, based on Sales Revenue for each Geography, Channel, and Time dimension member in the query. Finally, you will select Channel dimension members using the Members tab, as you did with the crosstab.

Back to Topic List

Follow these steps to modify the selections for the graph:

Change the Geography Selection Using a Saved Selection
Change the Channel Selection
Test the Ranking Condition

 

Change the Geography Selection Using a Saved Selection

Back to Subtopic List

To modify the Geography selection by applying a Saved Selection, perform the following steps:

1.

Click the Query Editor tool on the toolbar of the Sales Analysis Graph.

Select the Dimensions tab in the Query Wizard.

 

2.

In the choose box, select Geography.

Click the Remove All Items shuttle button ('<<') to remove the current selection.

 

3.

In the Available region, click the Saved Selections tab. Your two Geography Saved Selections are displayed.

Select America Areas and then click the Add Selected Items shuttle button ('>') to move the saved selection to the Selected List.

Move your mouse over this icon to see the image

 

 

Change the Product Selection Using a Condition

To specify the ranking query, you will construct the following Steps for the Product dimension in Query Builder:

Select all the products in the Photo division
Keep only the top 5 Products based on the Sales revenue

Back to Subtopic List

To create the Product ranking condition, perform the following steps:

1.

Ensure that the Dimensions tab is selected in the Query Wizard. In the Choose box, select Product.

Move your mouse over this icon to see the image

Click the Remove All Items shuttle button ('<<') to remove the current selection.

 

2.

In the Members tab of the Available list, expand Product total by clicking on the drill symbol ('+'). Select Photo and click the Add Selected Items shuttle button ('>') to move Photo to the Selected list.

Move your mouse over this icon to see the image

 

3.

In the Available list, select the Conditions tab.

Move your mouse over this icon to see the image

 

4.

In the Conditions list, there are templates that can be customized to match the condition that you want to specify.

Expand the Top/Bottom folder and select the template Top 10 based on Sales Revenue. Click the Add Selected Items shuttle button ('>') to move the condition to the Selected list.

Move your mouse over this icon to see the image

 

5. In the Selected list, select the Top 10 condition. Click the first hypertext link: ‘Add’. Select ‘Then Keep’ from the list.

Move your mouse over this icon to see the image

 

6.

In the condition, click the '10' hypertext link and change it to '5' so that the condition reads as follows:

Keep Product: Top 5 based on Sales Revenue

Move your mouse over this icon to see the image

This condition will Keep the top 5 products in the Photo division. This means the Photo division member itself will not be part of the member selection that is returned by this condition.

 

7.

Now, you will qualify this ranking condition so that it will be re-evaluated when any new Geography or Time member is selected from the Page dimension tiles in the graph.

First, click the Edit Step tool (pencil icon) to display the Edit Step box.

Move your mouse over this icon to see the image

 

8.

An OLAP ranking condition returns the appropriate dimension members for the condition by using a specific combination of values for the remaining,or qualifying, dimensions in the query. The values for these dimensions are displayed in the For box.

For example, as shown in the Edit Step dialog above, our ranking condition would return the top 5 products for Channel total, Americas, Promotion total and 1998.

In an OLAP ranking condition, you can use the Qualify button to select a different dimension member for each of the qualifying dimensions in the query.

Even more, you can specify that the ranking condition should be re-executed each time you select a new member from a qualifying dimension that is in the Page Items region of the crosstab. To do this, choose the Selected <Dimension> page item option in the dimension value drop-down list.

Click on the Qualify button.

Move your mouse over this icon to see the image

The Qualify Measure-Sales Revenue dialog box opens.

 

9.

In the column ‘Include Sales Revenue In’, select Each Geography for the Geography dimension.

Move your mouse over this icon to see the image

 

10.

In the column ‘Include Sales Revenue In’, select Each Time for the Time dimension.

Move your mouse over this icon to see the image

Click OK.

The Edit Step dialog box now shows that the "Top 5 Products" condition will be re-evaluated for all Geography and Time dimension members, but will only be evaluated for the Channel total and Promotion total dimension members.

Move your mouse over this icon to see the image

Click OK to complete the condition and close the Edit Step dialog box.

 

11.

Click the Sort button below the Selected list in the Query wizard to display the Sort Members dialog box.

Choose the Sort members by option and then click Add.

Move your mouse over this icon to see the image

The Edit Sort Criterion dialog box opens.

 

12.

In the Edit Sort Criterion dialog, select Product name from the Sort By options list, then click OK.

Move your mouse over this icon to see the image

The Sort Members list box will show the condition as follows:

Move your mouse over this icon to see the image

Click OK to close the Sort Members dialog box.

 

13. In the Query Wizard, click Apply to apply the changes. Do not exit the Query Wizard.

 

Change the Channel Selection

Back to Subtopic List

To modify the Channel selection, perform the following steps:

1.

In the Choose box, select Channel.

Click the Remove All Items shuttle button ('<<') to remove the current selection.

 

2.

In the Available list, select the Members tab. Click the drill symbol ('+'), which is located to the left of Channel total to expand it.

Click on the Add all Items shuttle button ('>>') to move all the channels to the Selected list.

Move your mouse over this icon to see the image

Click OK to apply the changes and close the Query Wizard. The graph will look as shown below:

Move your mouse over this icon to see the image

 

3.

From the File menu, select Save All to save your work.

 

 

Test the Ranking Condition

Back to Subtopic List

To test the ranking condition perform the following steps:

1.

Click the Time dimension and select 1999. The graph updates with a new set of top 5 products.

Move your mouse over this icon to see the image

 

2.

Click the Geography dimension and select Canada. The graph updates with a new set of top 5 products.

Click the Geography dimension and select Argentina. Once again, the graph updates with a new set of top 5 products. Notice that there is only one channel of distribution in Agentina - Direct.

Once again, click the Geography dimension and select Americas. The graph updates with a new set of top 5 products.

From the File menu, select Save All to save your work. Choose File > Close to close the graph.

 

 

In this lesson you learned how to use the Query Builder to:

Select measures for a query.
Modify the layout of presentations
Specify dimension selections that define the data that is displayed in crosstabs and graphs.

In the next lesson, you will learn how to create highly-formatted crosstabs and graphs using the Presentation Editor.

Move your mouse over this icon to hide all screenshots