Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Return the Rank of a Single Item within a group

685036Aug 20 2009 — edited Aug 22 2009
Hello - I'm interested in generating a report in OBIEE that returns a single row that shows an item and it's rank within a group.
I accomplish this in SQL by:
1. ranking every item in the group
2. selecting a single item and it's rank from the results in step 1

I can rank every item in a group in OBIEE, but I haven't found a way to then get just a single item and it's rank from the result set. Each time I try to restrict my results to a single item I lose the value of the Ranking within the group. I've thought about level-based measures, filter using anothe request, etc, but haven't come up with a way to do it.
Here's a sample of the SQL I'd use to return just the row I'm interested in (here I'm ranking websites by total visits within their zone, then returning a single website and it's rank that I'm interested in):

select website,
websiterank

from

(select website,
Rank () over (partition by zone order by sum(total_visits) desc) websiterank

from web_sessions,
corporate_hierarchies

where web_sessions.website = corporate_hierarchies.website and
corporate_hierarchies.zone = 'North Central')

where website = 'GMAutos'

Has anyone out there accomplished the same? Let me know!

Thanks -- Matt
Comments
Locked Post
New comments cannot be posted to this locked post.