COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Sarayucog on 25 Jul 2011 06:08:58 AM

Title: how to find Top 10 records in chart
Post by: Sarayucog on 25 Jul 2011 06:08:58 AM
Hi All,

I am using Cognos 8.4 version. I have report with list and chart are assigned to the same query. I am calculating top 10 records in this report. I am applying sorting on one of the measure. In list report I am getting the correct result, but not in chart. Chart is sorting the values by its own. If I am any sorting on the chart columns its not taking into consideration.

Let us assume we have 100 records. From that 100 records number 20 - 30 records are top 10 records. These are displaying list, but it chart its displaying number 1- 10 records as top 10 records.

What to do sort the chart to get the correct result. I have tried sorting and Advanced Sorting and pre-sort property in query also, but no use.

Please tell me the solution, your help will be appriciated.
Title: Re: how to find Top 10 records in chart
Post by: PRIT AMRIT on 25 Jul 2011 09:16:22 PM
Though I am not sure how you are trying to get Top 10 records, if not this way, then try to filter the query by Top 10 records first and then use the same query for your List & Chart Report.

To filter the Query by Top 10, Create a Data Item 'Rank' in your query with below expression;

Rank([Measure])

In filter: [Rank] <=10

This would give you the Top 10 records. Now on report you can do Asc(1-10) or Desc (10-1) based on your requirement.

Hope this helps?
Title: Re: how to find Top 10 records in chart
Post by: saumil287 on 28 Jul 2011 07:39:05 AM
hi,
In your query have u applied a group by on customername or on some attribute which is not an identifier.
thats why u are getting different results.
check the query again
Title: Re: how to find Top 10 records in chart
Post by: d0n_mac on 28 Jul 2011 09:26:19 AM
Hi,

I've Done something which is a bit more complex than above but it works well for me and it handles zeros and blanks which I had dificulty with.

I put a filter on my products

filter

filter(
filter(
filter([VC Sales Analysis].[All Products].[All Products].[Product],
value(tuple([Date Select],[Invoiced])) is not null),
value(tuple([Date Select],[Invoiced]))<>0) ,
value(tuple([Revenue],[Invoiced]))<>0)

then I have got 2 different order data items

Top

order([Products Filter],Value(tuple([Date Select],[Invoiced])),BDESC)

Bottom

order([Products Filter],Value(tuple([Date Select],[Invoiced])),BASC)

Then I use another 2 data items for the top 10 and bottom 10

Top

head([Order Products Top],10)

Bottom

head([Order Products Bottom],10)

Its a bit more long winded than Rank but rank didn't work for me where as this does exactly what I want.

Title: Re: how to find Top 10 records in chart
Post by: cogrep on 26 Oct 2012 05:29:52 AM
hi guys

bit new to this post

i have a requirement similar to above, the only part different is i have to pull the rank based on the count
for example i have node, summary, tally(fact),
now i have grouped the list report by node and i have taken the count (tally). but when i am assigning the rank it is assigning to sum(tally) not to count (tally) and i also want to filter the report based on the rank like top 50 or top 10 any help is much appreciated .
thanks in advance for help