If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

[Solved] Ranking Grouped Data

Started by Gooch, 04 Jan 2006 10:45:44 AM

Previous topic - Next topic

Gooch

Hello.

I have a table as follows :-

REGIONÃ,  Ã, RANKÃ,  Ã, BRANCHÃ,  Ã,  Ã, SALES
NorthÃ,  Ã,  Ã,  1Ã,  Ã,  Ã,  Ã,  Ã,  GlasgowÃ,  Ã,  30000
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 4Ã,  Ã,  Ã,  Ã,  Ã,  AberdeenÃ,  10000
SouthÃ,  Ã,  Ã,  2Ã,  Ã,  Ã,  Ã,  Ã,  BristolÃ,  Ã,  Ã,  Ã,  25000
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, 3Ã,  Ã,  Ã,  Ã,  Ã,  LondonÃ,  Ã,  Ã,  15000

I need to rank this by Sales within each region....any ideas of the required expression for this?

Gooch.Ã, 

bdybldr

Gooch,
Try changing your rank calculation to:

Rank([SALES] for Region).  This will give you ranking within each region. 

Hope this helps.  Keep us posted.

johnsoncognos

order by sales descending and rank from there. 

If you want a top 10 type thing try the following SQL


select * from
(select
  region,
  branch,
  sum(sales) as sales
from some_table
  group by
     region,
    branch
  order by sum(sales)  desc)
where rownum < 10