COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Karanag on 24 Jun 2016 10:14:31 AM

Title: Show Top n rows in Report based on static value in Prompt
Post by: Karanag on 24 Jun 2016 10:14:31 AM
Hi All,

I have come up with the issue that I have one value prompt where I have given static choices like 10,20,...till 100 so basically 10 static choices and based on that I want that much rows on my report page .Lets say If I have selected 10 then 10 rows should be display in the report likewise.
If someone can guide me on that ..
Title: Re: Show Top n rows in Report based on static value in Prompt
Post by: raj_aries81 on 27 Jun 2016 02:18:10 AM
Hi Karnag,

You can use a rank funtion and then order it by asc/desc then pass the prompt value to the report.

Regards
Raj
Title: Re: Show Top n rows in Report based on static value in Prompt
Post by: dougp on 27 Jun 2016 06:58:30 PM
If the query is sorted the way you want using running-count with a filter will also work.
Title: Re: Show Top n rows in Report based on static value in Prompt
Post by: cognos-t on 28 Jun 2016 07:09:17 AM
Hi,

the solution of using a running-count on a rank function may lead to different results then filtering on the the rank function.
The following example shows the different results

Value    Rank    Running-Count on Rank
10            1                       1
20            2                       2
25            3                       3
30            4                       4
40            5                       5
40            5                       6

When you filter for the top 5 values now, a filter on the rank functions will include the second value 40 while it will be filtered out by using a filter on the running-count. You should consider which approach to choose based on your requirements.

Best regards, 


           
Title: Re: Show Top n rows in Report based on static value in Prompt
Post by: Karanag on 25 Jul 2016 12:38:27 PM
Thanks Guys Running count worked in my case I just change the detail filter property 'After auto aggregation' and it worked.

Cheers