logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
epf  
#1 Posted : Friday, April 11, 2014 2:47:11 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

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

Users browsing this topic
Guest
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.