I try to create a dynamic ranking. For instance, I have an attribute called score with value from 1 to 1000. First I need to sort it in descending order from high to low, then based on the score I need to create 5 or 10 or 25 or 30 or 50 or 100 bins/groups with equal counts of the population in each bin/group and in the same time find out what is the score range for each bin. For example, if it is 10 bins, I need assign 10% population for each bin and the top bin's score range might be from 950 to 1000, and the bottom bin's score range might be from 1 to 200. I wonder if anyone can help on this and I will appreciate it.