Seal Report Forum
»
Report Edition
»
Advanced Tricks and Tips
»
Analytic 1: Adding a Rank column in Oracle and SQL Server
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
This post explains how to add an element in your model that gives the rank of a result... This uses the analytic function rank() OVER of SQLServer or Oracle: rank() over(order by sum(amount) desc) as example, we consider that we have a model build like this: the Order Date as a Row element, and the Sum of Amount as Data element... the basic result table in you report looks like: date amount 1/1/2000 120 1/2/2000 180 1/3/2000 110 to add a rank() column:
- drag and drop again the Amount element in your Data elements
- rename it to Rank
- expand Advanced and set the Custom SQL property: rank() over(order by sum(amount) desc)
this will add the rank column and your result table will look like this: date amount rank 1/1/2000 120 2 1/2/2000 180 1 1/3/2000 110 3 rank() is an example but you could use other aggregate/analytic functions provided by the database engine... Edited by user Tuesday, May 13, 2014 2:27:29 PM(UTC)
| Reason: Not specified
|
|
|
|
Seal Report Forum
»
Report Edition
»
Advanced Tricks and Tips
»
Analytic 1: Adding a Rank column in Oracle and SQL Server
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.