- IBM Cognos 8 Report Studio Cookbook
- Abhishek Sanghani
- 572字
- 2021-08-06 17:15:44
Aggregation and rollup aggregation
Business owners want to see the unit cost of every product. They also want the entries to be grouped by product line and see the highest unit cost for each product line. At the end of the report, they want to see the average unit cost for the whole range.
Getting ready
Create a simple list report with Product | Product line, Product | Product name and Sales Fact | Unit Cost as columns.
How to do it...
- We will start by examining the Unit Cost column. Click on this column and check the Aggregate Function property.
- Set this property to Average.
- Add grouping for Product line and Product names, by selecting those columns and hitting the GROUP button from toolbar.
- Click on the Unit Cost column and click on the Aggregate button from toolbox. Select Aggregate option from the list.
- Now click again on the Aggregate button and choose Average option.
- This will create footers shown as follows:
- Now delete the line with Average (Unit cost) measure for Product line. Similarly, delete the line with <Unit cost> measure from Summary. The report should look like this:
- Click on the Unit cost column and change its rollup aggregate function to Maximum.
- Run the report to test it.
How it works...
In this recipe, we have seen two properties of the data items related to aggregation of the values.
We first examined the aggregation property of unit cost and ensured that it is set to average. Remember that the unit cost here comes from the sales table. The grain of this table is sales entries or orders. This means there will be many entries for each product and their unit cost will repeat.
We want to show only one entry for each product and the unit cost needs to be rolled up correctly. The aggregation property determines what value is shown for unit cost when calculated at product level. If it is set to TOTAL
, it will wrongly add up the unit costs for each sales entry. Hence, we are setting it to AVERAGE
. It can be set to MINIMUM
or MAXIMUM
depending on business requirements.
In order to show the MAXIMUM
unit cost for product type, we create an 'Aggregate' type of footer in step 4 and set the Rollup Aggregation to Maximum in step 8.
Note
Here we could have directly selected MAXIMUM
from the 'Aggregate' drop-down toolbox. But that creates a new data item called Maximum (Unit Cost). Instead, we ask Cognos to aggregate the number in footer and drive the type by rollup aggregation property. This will reduce one data item in the Query Subject and Native SQL.
We also need to show the overall average at the bottom. For this we have to create a new data item. So, we selected unit cost and created an 'Average' type of aggregation in step 5. This calculates the Average (Unit Cost) and places it on the product line and in the overall footer.
We then deleted the aggregations that are not required in step 7.
There's more...
The rollup aggregation of any item is important only when you create the aggregation of 'Aggregate' type. When it is set to automatic, Cognos will decide the function based on data type which is not preferred.
It is good practice to always set the aggregation and rollup aggregation to meaning function than leaving as 'automatic'.
- 剪映短視頻剪輯零基礎一本通
- UG NX10.0從新手到高手
- Creo 4.0中文版從入門到精通
- AutoCAD 2014中文版完全自學手冊
- Inkscape 0.48 Illustrator's Cookbook
- Excel 2013電子表格處理
- DWR Java AJAX Applications
- 中文版 Photoshop CC 從入門到精通
- Photoshop CS6中文版從入門到精通(核心技法卷):摳圖、修圖、Camera Raw、調色、銳化、合成
- 用Cubase輕松制作你的短視頻音樂
- 新印象Premiere短視頻拍攝+剪輯+特效關鍵技術
- CorelDRAW X6核心應用案例教程(全彩慕課版)
- Power Query For Excel:讓工作化繁為簡
- 中文版Photoshop CS5平面設計實用教程(第2版)
- Excel 2010 Financials Cookbook