COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: ArnaudStephanHTH on 30 Sep 2019 05:17:52 AM

Title: Summarize a category after a certain rank
Post by: ArnaudStephanHTH on 30 Sep 2019 05:17:52 AM
Hello,

My data looks like that :


 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
WeekSectionQuantity
20A2
20B5
20C4
20D3
20E10
20F6
20G5.5
20H9
21A1
21B4
21C7
21D4
21E2.4
21F3
21G6
21H5

And I would like to show it in a pivot table, but I would like to only show the top 5 sections by week, summarizing the remaining sections in an "Other" category.

I created a rank like this : rank([Quantity] for [Week];[Year]) and filtered to only include the 5 top ranks. It works fine, but I don't know how to create the "Other" category and display it.

Any ideas on how to proceed ?
Title: Re: Summarize a category after a certain rank
Post by: ArnaudStephanHTH on 30 Sep 2019 06:55:05 AM
I found a solution, although I'm sure there are better ways.

First I created a new data item to categorize the ranks : CASE WHEN [Rank] < 6 THEN [Rank] ELSE 999 END
Then I computed the total based on this new data item :total ([Quantity] for [Rank Inf 5])
Title: Re: Summarize a category after a certain rank
Post by: MatusM on 21 Oct 2024 10:13:31 AM
Quote from: ArnaudStephanHTH on 30 Sep 2019 06:55:05 AMI found a solution, although I'm sure there are better ways.

First I created a new data item to categorize the ranks : CASE WHEN [Rank] < 6 THEN [Rank] ELSE 999 END
Then I computed the total based on this new data item :total ([Quantity] for [Rank Inf 5])

I have the same use case, but this solution is not working properly on Cognos 12.0.3.

Totals of top X items vs Other are not computed correctly, probably because Rank is being determined not in the beginning, but in parallel with Total calculation.

Solve order property of data items does not help either.