Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
erisman20
Contributor III
Contributor III

Help Calculating Rank

Hello Everyone,

I have attached a qvf file for an example data set to this problem.

To summarize, I have a data model that includes a set of Questions, Teachers, Teacher's Students, and Student Scores for each question.

I want to create a table that displays a specific teacher's rank based on their students' average score for each question. 

Teacher 1 Rank Table:

Question Rank

q1Teacher 1 Rank
q2Teacher 1 Rank
q3Teacher 1 Rank

 

Teacher will not be a field in the table, and each question will only show up once

Thanks!

Jordan

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar

Are you looking for this?

image.png

Expression

Only({<Teacher = {'t1'}>}Aggr(Rank(Sum(Score)), Question, Teacher))

View solution in original post

7 Replies
dplr-rn
Partner - Master III
Partner - Master III

Maybe i am over simplifying the problem.

is below what you want

Annotation 2019-01-23 125456.jpg

erisman20
Contributor III
Contributor III
Author

Not quite, I want a table that that only has the list of questions and a rank for a specific teacher. For example, the following table would be created for Teacher 1

Question Rank

q1Teacher 1 Rank
q2Teacher 1 Rank
q3Teacher 1 Rank
dplr-rn
Partner - Master III
Partner - Master III

change the sort order and use a filter. (see below)
is the data accurate?

 Capture.jpg

erisman20
Contributor III
Contributor III
Author

No, teacher field should not be in the table and I only want one row per question.

dplr-rn
Partner - Master III
Partner - Master III

Ok. Your were not clear before
Try and Use firstsortedvalue
sunny_talwar

Are you looking for this?

image.png

Expression

Only({<Teacher = {'t1'}>}Aggr(Rank(Sum(Score)), Question, Teacher))
dplr-rn
Partner - Master III
Partner - Master III

Assuming you want the top ranked teacher for each question. Use FirstSortedValue(Teacher,-Aggr(Sum(Score),Question,Teacher))

Capture.jpg