Questions tagged [ranking-functions]

Ranking functions return a ranking value for each row in a partition. Depending on the function that is used, some rows might receive the same value as other rows. Ranking functions are non-deterministic.

193 questions
-1
votes
1 answer

Can SQL dense rank work for count of (non distinct) value changes with respect to time

Using SQL I have a list of credits for a course by year. I want to get a count of how many values the 'credits' attribute has been over years. If a value occurs twice (non consecutively) I want it counted. As follows, you can see there are 3…
Jojo
  • 13
  • 2
-1
votes
2 answers

SQL query to get start and end date from a result set

I am working on one of requirement the raw data is in following format Requirement - Startdate should be the date when status changed to 1 and enddate should be the 1st date after the record status changed from 1 to any other…
BIDeveloper
  • 767
  • 3
  • 14
  • 28
-1
votes
1 answer

Ranking the Resulting Values of Measures in Power BI

Please help. I am trying to create a dashboard (one-page) that shows KPIs of multiple groups. There are 10 groups and each group is represented with a box and the box is showing the group's %Compliance. Now, I want to add the RANK of this group's…
cdespino
  • 1
  • 2
-1
votes
2 answers

SQL Ranking Functions for Sorting and Aggregating Data for Conversation Data

I'm looking to rank/aggregate conversation data in SQL (specifically BigQuery). The data is conversation data where each row represents one sentence. In the image below I have added the example data for speaker, sentence, and sequence_start. The…
Adam
  • 19
  • 1
  • 4
-1
votes
2 answers

If salary of employee is up to 5000 then rank =1, up to 100k then rank = 2 and so on. can we get the result using rank function?

If salary of employee is below 50,000 then rank = 1, up to 100 000 then rank 2, up to 150 000 then rank 3.Can I get this using rank function? SELECT CASE WHEN SALARY BETWEEN 1 , 50000 then 1 else case when salary between 50000 , 100000 then 2 else…
-1
votes
2 answers

SQL dense ranking function

I have a table called employees, with 'employee_id' and 'bonuses' as columns. The employee_id's are repeated because they have multiple bonuses of different amounts, and I want to rank them by their total bonus amount. So, I was wondering if this…
-1
votes
3 answers

How can I group student scores into quintile using SQL Server 2008

Can anyone help me to group student scores into quintile? I think there is a feature in SQL Server 2012, but still we havent upgraded to it as we are using 2008R2. I triedNtile(5)` but it is not generating the desired result. I need below Quintile…
Mike
  • 1
  • 1
  • 3
-1
votes
2 answers

Pull out the a spefic "rank" from an HashMap not yet sorted which also contains different values but same key or better same count;

I have this HashMap containing words and the count for each word from a given text file; {word=1, word2=1, word3=2, word4=1, word5=1, word6=4, word7=1, word8=1}; i was following your suggestion in other topics; but i have notice that if use fro…
Franco
  • 875
  • 1
  • 6
  • 14
-2
votes
1 answer

rank() based on certain column condition in SQL

I want to rank the students based on their attendance report on each day. The ranking should start for each student separately. Below is the expected output, Expected…
Beginner
  • 143
  • 1
  • 12
-2
votes
3 answers

SQL Server Ranking - Ignoring Duplicate Row Values

I'm hoping someone can point me in the right direction here. I have a unique requirement with regards to ranking records in a SQL Server table. The table looks like this... This table shows a member of a health club and their various status…
Dan
  • 533
  • 2
  • 10
  • 21
-3
votes
1 answer

Customized weight based ranking mechanism

I have the following problem I would like to tackle. I have a list of elements 'Ei' (element i), each with several parameters. The parameters are similar and each is assigned with a weight 'Wx' (Weight for parameter x). The weight can be changed…
Boris Ka
  • 79
  • 1
  • 1
  • 8
-4
votes
2 answers

How could I use a hash and create a list of names and scores and the rank them?

EX. Joe 90, Mike 80, Steve 100. How would i print out something like below? Is it even possible in Ruby? Rank Name Score 1 Steve 100 2 Joe 90 3 Mike 80 Any help greatly appreciated!!
-4
votes
1 answer

What is the equation that is used for rank the user feedback in five stars

i have a excel sheet that has the users feedback (Excellent, Very Good, Good,Bad , Very Bad) with numbers for each cell. what is the equation that i can use to get the rank for each user out of 5 stars.
1 2 3
12
13