Vous êtes sur la page 1sur 16

Tip or Technique

Creating Dynamic Analysis Studio


Type Reports in Report Studio
Part-1
Product(s): Report Studio
Area of Interest: Report Design

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

Copyright
Copyright 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULC
is an IBM Company. While every attempt has been made to ensure that the
information in this document is accurate and complete, some typographical
errors or technical inaccuracies may exist. Cognos does not accept
responsibility for any kind of loss resulting from the use of information
contained in this document. This document shows the publication date. The
information contained in this document is subject to change without notice.
Any improvements or changes to the information contained in this document
will be documented in subsequent editions. This document contains
proprietary information of Cognos. All rights are reserved. No part of this
document may be copied, photocopied, reproduced, stored in a retrieval
system, transmitted in any form or by any means, or translated into another
language without the prior written consent of Cognos. Cognos and the
Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated)
in the United States and/or other countries. IBM and the IBM logo are
trademarks of International Business Machines Corporation in the United
States, or other countries, or both. All other names are trademarks or
registered trademarks of their respective companies. Information about
Cognos products can be found at www.cognos.com
This document is maintained by the Best Practices, Product and Technology
team. You can send comments, suggestions, and additions to
cscogpp@ca.ibm.com .

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

Contents
1

INTRODUCTION ............................................................................................ 4

1.1
1.2

PURPOSE ............................................................................................................4
APPLICABILITY .....................................................................................................4

REPORT REQUIREMENTS.............................................................................. 4

2.1

EXAMINING THE ANALYSIS STUDIO REPORT ..................................................................4

REPORT STUDIO REPORT ............................................................................. 5

3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9

STEP1 ...............................................................................................................5
STEP 2 ..............................................................................................................5
STEP 3. .............................................................................................................6
STEP 4 ..............................................................................................................8
STEP 5 ..............................................................................................................9
STEP 6 ............................................................................................................ 11
STEP 7 ............................................................................................................ 12
STEP 8 ............................................................................................................ 13
STEP 9 ............................................................................................................ 14

CONCLUSION .............................................................................................. 16

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

1 Introduction
1.1

Purpose
This document is intended to help anyone who has a requirement to use
Report Studio to perform some of their OLAP type reporting, yet still retain
some of the Analysis Studio type functionality. Only a couple of Analysis
Studio reporting techniques are created in this document, and it is intended
as an example of what can be done in Report Studio. This is part-1 of the
entire technique in which we will create the basic crosstab report which will
be used in part-2 where we further enhance the report and make it more
dynamic. An advanced knowledge of OLAP and report design for IBM Cognos
8 is recommended to fully understand the techniques in this document.

1.2

Applicability
This document was created using IBM Cognos 8 MR2 specifically the Great
Outdoors Company sample cube that comes with the product. At the time
the document was created all techniques were validated and supported.

2 Report Requirements
2.1

Examining the Analysis Studio Report


Assume the report you need to recreate in Report Studio is a crosstab report
with Products on the rows, and Years on the columns. For the sake of
simplicity the totals for Years has been removed and the number of visible
items on the rows is set to a custom level of 2. The report in Analysis Studio
looks like the one below (diagram 1).
Diagram 1.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

We now know that we need to create a report which has Products


(summarized) on the Rows with the number of visible items set to 2, Years
(not summarized) on the columns and lastly we have to create some sort of a
calculation that will calculate the total of all remaining products that we cant
see.

3 Report Studio report


3.1

Step1
Open Report Studio against the Great Outdoors Company sample cube and
when prompted choose to create a new report, and then choose the crosstab
template to work from. From the Tools menu select Options and ensure
the Show members folder check box is enabled (Diagram 2.).
Diagram 2.

3.2

Step 2
Expand the Years dimension, then the Years Hierarchy and drag Year
level onto the columns and then from the Measures drag Quantity sold into the
cells (diagram 3.).

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

Diagram 3.

3.3 Step 3.
Now expand the Products dimension, then the Products hierarchy, then the
Products level, and finially the Members folder and drag the Products member
onto the rows of the report. Youre report should now look like Diagram 4 and when
run the results should look like Diagram 5. Save this report at this point so if a
mistake is made you have something to fall back on.
Diagram 4.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

Diagram 5.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1
3.4 Step 4
This isnt quite what we had in Analysis Studio. For starters we need to have the
Products level expanded to show the members beneath it, and then we have to
restrict the number of members we actually see to 2. We inserted the Products
level for a reason. While its not quite the level of data we wish to see, it is needed
in order to create some of the new members were going to create as well its key
to have this level in our report for the dynamic feature of this report youll create
later on.
First we need to create a new member which will display the member beneath the
Products level. To do this open the Query Explorer window and select Query1
(Diagram 6.)

Diagram 6.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

3.5 Step 5
Using the Toolbox, drag a Data Item from the Insertable Objects pane into the
Data Items section of your query (Diagram 7). In the Expression Definition box
type in children(). Now select the Data Items tab of the expression editor and
drag the Products data item in between the ( and ) brackets. Your calculation
should look like, children(Products), see Diagram 8.
Diagram 7.

Diagram 8.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

Rename this data item to something a little more logical like Full Members List
(Diagram 9).
Diagram 9.

IBM Cognos Proprietary Information

10

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

11

3.6 Step 6
The next step is to create the member which will display only the number of
members from the Full Members List that was defined by the report specification.
In this case we only wish to show the first 2 members. To do this we need to create
a new data item. From the Tool Box drag a Data Item object into the Data
Items pane. In the Expression Definition dialog box enter the following syntax:
_firstfromset(
Next select the Data Items tab for the Available Components, and drag the query
item we previously created (Full Members List) to the right of the syntax you just
entered. Youre calculation should now look like (Diagram 10).
_firstfromset([Full Members List]
Diagram 10.

To complete the calculation we need to tell the function the number of members to
display (numeric_exp_max), as well as define the number for overflow
(numeric_exp_overflow). In our case we are going to use 2 for both, each value is
separated by a comma. Your final calculation should look like (Diagram 11.)

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

12

Diagram 11.

If you choose to, verify the calculation and then press the OK button. Lastly
rename the data item to something more descriptive like Products Displayed

3.7 Step 7
Next you need to create the calculation to calculate the total of all the members in
the level, whether they are displayed or not. To do this you need to once again add
a new data item. Follow the same steps as what were described previously to add a
new Data Item object. In the syntax enter the following: (Diagram 12)
total(currentMeasure within set [Full Members List])
When ready validate the expression and then press OK. Rename the data item to
Total.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

13

Diagram 12.

3.8 Step 8
Next you need to create the calculation to total the members not displayed in the
level. To do this you need to once again add a new data item. Follow the same
steps as what were described previously to add a new Data Item object. In the
syntax enter the following: (Diagram 13)
member([Total] - (aggregate(currentMeasure within set [Products
Displayed])),'More Subtotal','More Subtotal',hierarchy([Full Members List]))
When ready validate the expression and then press OK. Rename the data item to
More Subtotal. Lets look at this calculation a little closer. We have already
created the [Total] calculation which calculates the total quantity for all members in
the level. In order to calculate the total of the members not displayed by the
Products Displayed data item we will need to take the total for all the members in
the level and subtract the total of the members which are displayed. To calculate
the total of the members displayed in the report we use the following syntax:
aggregate(currentMeasure within set [Products Displayed])

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

14

You can either create a separate data item for this total, or include it in the Member
Subtotal data item as I have done here. Since we do not need this total for any
other part of the report it simplifies things to have it built into the Member Total
data item. The last part of this calculation has 3 parts, one which defines the data
item within the report, the second piece is the caption for the data item used in the
report and the last part defines the hierarchy for which the calculation is based upon.
Diagram 13.

3.9 Step 9
Next we need to add the data items weve created into the actual report page. From
the Page Explorer select Page1. Either right click on the Products data item and
select Cut or Left click the Products data item to highlight it and then select cut
from the Edit menu to remove this data item. We dont want to delete it from the
report, just remove it from the page so we use cut.
Now select the Data Items tab from the Insertable Object pane and drag
Products Displayed onto the rows. Repeat the steps dragging the More Subtotal
data item, followed by the Total query item. Youre report should now look like
Diagram 14 and when run the results should look like Diagram 15.

IBM Cognos Proprietary Information

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

Diagram 14.

Diagram 15.

IBM Cognos Proprietary Information

15

Creating Dynamic Analysis Studio


Type Reports in Report Studio Part1

16

4 Conclusion
You should now have a report which resembles the default Analysis Studio structure
including "Visible Members". This is what Analysis Studio provides so that users are
able to focus on a limited number of items in their analysis session. In order to get
better business value from your reports, we suggest adding filters to these sets such
as Top X or something more meaningful to your business than simply the first X
members. Part 2 will provide more information about using member sets with filters.
The next step is to make this report more dynamic by allowing drilling up and down
on the members to mimic the behaviour that is by default available in Analysis
Studio. Creating Dynamic Analysis Studio Type Reports in Report Studio Part-2
will step you through how to enable drill through, as well as the use of Member
Sets to ensure that the proper context is retained when drilling up or down.

IBM Cognos Proprietary Information