4
Understanding the Cognos Summary Functions There are many built-in fu nctions that you can ad d to a calculation in a report. This document covers the Summaries function group. The Summaries function group contai ns functions such as averag e, count, total, rank, etc. It also includes many different statist ical functions. When you click on any function in Cognos, it gives you a tip about what the syntax should look like. All of the summary functions have three syntax options: 1. <function> ( [ distinct ] expr [ auto ] ) 2. <function> ( [ distinct ] expr for [ all | any ] expr { , expr } ) 3. <function> ( [ distinct ] expr for report ) Page 1 of 4

Understanding the Cog Nos Summary Functions

Embed Size (px)

Citation preview

Page 1: Understanding the Cog Nos Summary Functions

8/6/2019 Understanding the Cog Nos Summary Functions

http://slidepdf.com/reader/full/understanding-the-cog-nos-summary-functions 1/4

Understanding the Cognos Summary Functions

There are many built-in functions that you can add to a calculation in a report. This document

covers the Summaries function group.

The Summaries function group contains functions such as average, count, total, rank, etc. It also

includes many different statistical functions. When you click on any function in Cognos, it givesyou a tip about what the syntax should look like.

All of the summary functions have three syntax options:

1.  <function> ( [ distinct ] expr [ auto ] )

2.  <function> ( [ distinct ] expr for [ all | any ] expr { , expr } )

3.  <function> ( [ distinct ] expr for report )

Page 1 of 4

Page 2: Understanding the Cog Nos Summary Functions

8/6/2019 Understanding the Cog Nos Summary Functions

http://slidepdf.com/reader/full/understanding-the-cog-nos-summary-functions 2/4

Here is a breakdown of each part of the syntax statement.

-  Square Brackets [ ]: the statements contained within are optional.

-  Curly Brackets { }: the statements contained within are optional and can be repeated any

number of times.

-  <function>: input the desired function in place of this.-  distinct: this will use only distinct values to do the calculation.

-  expr: put any expression here. An expression can just be a field name or it can be a

calculation.

-  auto / any / all / report: use these to define the scope to be adjusted based on the grouping

columns in the query

-  for: define at what levels you want the summarization to take place

This is an example of how these can be used.

We want to count the number of departments for each campus and SPTS school across two fiscal

years. We also want to see how much each school’s counts contributes towards the each campus

count.

1.  Insert a new crosstab and populate as shown in the screenshot below with fields from the

Organization Unit table.

2.  Drag a calcualtion from the Insertable Objects Toolbox into the Measures section of the

crosstab.

3.  Name the calculation ‘Dept Count’ and choose a Detail calculation.

4.  Build the following calculation through dragging items from the Available Components

pane or typing the logic directly.

This calculation is going to do a count of distinct department numbers.

Page 2 of 4

Page 3: Understanding the Cog Nos Summary Functions

8/6/2019 Understanding the Cog Nos Summary Functions

http://slidepdf.com/reader/full/understanding-the-cog-nos-summary-functions 3/4

If we run the report, we get the following output. This tells us how many departments each

school has in both 2003-04 and 2004-05.

Now we want to insert a % of total calculation.

5.  Drag another calculation into the measures area of the crosstab.6.  Name it ‘% of Total’ and choose a detail calculation.

7.  Build the following calculation.

This calculation takes our previously calculated column of ‘Dept Count’ and divides it by

the total for its respective campus and fiscal year. To properly use the ‘for’, you need to

list the fields that are grouped in the crosstab. Because each school’s data is grouped by

campus and fiscal year, we need to include both of them after the ‘for’ clause. It does notmatter which order you place fiscal year and campus in this statement. They exist in

different dimensions and thus can be placed in any order.

This will yield the following output.

Page 3 of 4

Page 4: Understanding the Cog Nos Summary Functions

8/6/2019 Understanding the Cog Nos Summary Functions

http://slidepdf.com/reader/full/understanding-the-cog-nos-summary-functions 4/4

 

Agriculture makes up 8.57% of the total West Lafayette campus numbers for the 2003-04 fiscal

year and 8.02% for 2004-05. We divided the school totals by the entire campus total for each

fiscal year. (42/490 and 42/524 for 2003-04 and 2004-05 respectively.)

`If you have more than one level from the same dimension, you will need to place them in orderfrom more detailed to less detailed. For example, if we wanted to divide by the total for each

school, the for clause would look like this:

SPTS School and Campus are member of the same dimension with school being more detailed

than campus. Fiscal year can go either before school or after campus.

Page 4 of 4