Professional > Data management scripting > Publishing data > Cognos Framework Manager models > Building simple reports in Cognos Report Studio > Applying percentages on column respondents instead of responses
 
Applying percentages on column respondents instead of responses
It is often required to apply a percentage to multiple response questions on the number of respondents in each column rather than on the total number of answers or responses given. The following example follows the same basic steps as outlined in Building simple reports in Cognos Report Studio.
1 Create a crosstab with the following:
Add Age as a top dimension.
Add Museums as a side dimension.
Add Serial as the measure.
Add the filter [museums] is not null.
Add an automatic summary for Age and Museums.
Add Museums.Index in order to display categories in the questionnaire order.
The resulting table is:
Serial
11-16 years
17-20 years
21-24 years
25-34 years
35-44 years
45-54 years
55-64 years
65+ years
Summary
National Museum of Science
27
47
50
107
51
30
16
5
333
Museum of Design
6
14
14
21
15
12
8
2
92
Institute of Textiles and Fashion
4
7
10
13
5
3
5
1
48
Archeological Museum
3
5
4
7
4
2
1
 
26
National Art Gallery
1
5
5
4
2
2
 
 
19
Northern Gallery
2
2
7
3
2
3
2
 
21
Other
1
9
8
9
6
1
2
1
37
Summary
32
60
72
135
59
38
23
8
427
2 In Query Explorer, add a Data Item from the toolbox, name it pctage, and input the following expression:
[Serial]/[Summary(museums)]
3 Press OK.
Note You do not want to verify the expression syntax as it will result in a error at this stage.
4 Change the pctage Solve Order property to 100.
5 In Page Explorer select the table and then drag pctage from the Data Items pane to the serial column.
6 In Query Explorer, verify that serial is still present in the query (you must add serial if it is not present).
7 While still in Query Explorer, change the Solve Order for Summary(Museums) and Summary(Age) to 1. This ensures that the items are calculated before anything else, allowing them to be used in the pctage expression. The Data Items panes lists the following items:
Age
Museums
Summary(age)
Summary(museums)
museums.Index
pctage
Serial
8 In Page Explorer, change the Data Format property for the four table cells to Percent (using the percentage symbol and no decimal places).
The resulting table is:
Serial
11-16 years
17-20 years
21-24 years
25-34 years
35-44 years
45-54 years
55-64 years
65+ years
Summary
National Museum of Science
84%
78%
69%
79%
86%
79%
70%
62%
78%
Museum of Design
19%
23%
19%
16%
25%
32%
35%
25%
22%
Institute of Textiles and Fashion
12%
12%
14%
10%
8%
8%
22%
12%
11%
Archeological Museum
9%
8%
6%
5%
7%
5%
4%
 
6%
National Art Gallery
3%
8%
7%
3%
3%
5%
 
 
4%
Northern Gallery
6%
3%
10%
2%
3%
8%
9%
 
5%
Other
3%
15%
11%
7%
10%
3%
9%
12%
9%
Summary
100%
100%
100%
100%
100%
100%
100%
100%
100%
Note This method of calculating percentages can also be used for single response questions (as an alternative to the previously described expressions).
See also
Building simple reports in Cognos Report Studio