Page 1 of 1

Grouping of data

Posted: Tue Jul 23, 2019 9:25 pm
by skumar
Hi All


I need help in resolving below example. grouping the data based on the keys(date ranges)

for Example

Before grouping data
A B C D E
100 200 1 1/1/2000 5/1/2001
100 200 1 5/2/2001 8/7/2005
100 200 3 8/8/2005 1/4/2007
100 200 3 1/5/2007 2/1/2008
100 200 1 2/2/2008 6/8/2010
100 200 9 6/9/2010 NULL

After Grouping data

A B C D E
100 200 1 1/1/2000 8/7/2005
100 200 3 8/8/2005 2/1/2008
100 200 1 2/2/2008 6/8/2010
100 200 9 6/9/2010 NULL


Is there any way or function in DS to create RANK when a key combination changes for these between dates.

please help.

Thanks
Kumar

Posted: Fri Jul 26, 2019 6:56 pm
by ray.wurlod
Is this an exam question? I'm sure I've seen the requirement posted here previously.

That said, there is always a solution, possibly more than one.

For example, there is a function for detecting end of group, and you could initialise and increment a stage variable to determine rank (you'd need to figure out how to deal with tied ranks in that case).

Or you can drop the results into a database table and use the RANK function when retrieving from the same table.

As I said, more than one way.