Hello Friends,
I have a job similar to the ranking system in schools and colleges.. I am doing this job in Data stage and i am not getting the exact answer, for example
St_name marks
Joe 100
Tim 100
Jacob 50
Jason 20
The expected result, should be
St_name marks rank
Joe 100 1
Tim 100 1
Jacob 50 3
Jason 20 4
i tried this with all possible ways i know but i am not getting it...
Ranking system in Data stage
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 46
- Joined: Mon Sep 24, 2007 12:37 am
- Location: INDIA
-
- Participant
- Posts: 85
- Joined: Fri Nov 18, 2005 5:35 am
-
- Participant
- Posts: 46
- Joined: Mon Sep 24, 2007 12:37 am
- Location: INDIA
-
- Premium Member
- Posts: 99
- Joined: Mon Sep 03, 2007 7:49 am
- Location: Stockholm, Sweden
build a couple of stage varibles checking that records change and a counter and a rank. Add rank with the counter value if a record has changed, then reset the counter and continue....
pseudo code:
if this_value equals prev_value then count = count+1 else count = 1
if this_value equals prev_value then rank = rank else rank = rank+count
or something similar to that .
Remeber to have your data sorted and beware of partitioning mistakes...
pseudo code:
if this_value equals prev_value then count = count+1 else count = 1
if this_value equals prev_value then rank = rank else rank = rank+count
or something similar to that .
Remeber to have your data sorted and beware of partitioning mistakes...
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles