Forum Discussion

dphillips's avatar
dphillips
Icon for Helper IV rankHelper IV
7 years ago
Solved

Rank based on a measure

I have marks from students who have completed some tests. I have created a measure which gives me the average of the students results.

Scld Mark Ave =  AVERAGE(uncRedshift_Studentresults[Scld])

I have slicers on the page which filter the Fileyear and Student_ID so I get an average Scaled mark for a particular student in a particular year. This works fine.

 

Now I would love to give a rank to each student eg Student_ID 1234 with an average scaled mark of 62.45 is ranked 78th out of the whole year group of 230 Year 9 students in 2018. In other words, I want to rank the average scaled mark for this student against the average scaled mark for everyone else in the Year Group for a particular year. I want to put this in a card eg "78 out of 230". Not sure at all how to go about doing this?

 

I have provided some data with students with scaled marks in their subjects by Year and YearLevel.

 

https://docs.google.com/spreadsheets/d/1pYOpN_q_5KTVxu6ZqRqFIrOUiJLxS38XDubrNVWwdSo/edit?usp=sharing

 

Any help would be much appreciated.

  • dphillips add following measure for rank 

     

    Rank = 
    RANKX( 
        FILTER( 
            ALL( Sheet1[FileYear], Sheet1[StudentYearLevel], Sheet1[StudentID] ),
            Sheet1[FileYear] = MAX(Sheet1[FileYear]) && 
            Sheet1[StudentYearLevel] = MAX( Sheet1[StudentYearLevel] )  
        ), 
        [Average Marks], , ASC, Dense
    )
    

6 Replies

  • dphillips add following measure for rank 

     

    Rank = 
    RANKX( 
        FILTER( 
            ALL( Sheet1[FileYear], Sheet1[StudentYearLevel], Sheet1[StudentID] ),
            Sheet1[FileYear] = MAX(Sheet1[FileYear]) && 
            Sheet1[StudentYearLevel] = MAX( Sheet1[StudentYearLevel] )  
        ), 
        [Average Marks], , ASC, Dense
    )
    
    • dphillips's avatar
      dphillips
      Icon for Helper IV rankHelper IV

      parry2k  - Thanks for the info. I keep getting a rank of 1 for any student I select. Have looked at your measure and tested filters, and the aggregations used, substituted in actual values etc, but I still always get a rank of 1 no matter which student I select. Any thoughts about what I am doing wrong? This is my measure for getting the average scaled mark for a student.

      Average Marks = AVERAGE([ScldMark])

      I then have slicers on the page for Fileyear, StudentYearLevel and StudentID.

       

      I want this to be displayed in a card on its own.

       

      Perhaps the problem is that this needs to be in a table or matrix so it can rank against the other values in the visual. If that is the case, how can I get this to be a standalone rank in a card? (Just tested this theory in a table and found that your measure works great - everything correct  - thanks so much - but as I said - I want to try and create a kpi matrix which uses a card with just the rank for that one student)

      Any thoughts?

      • parry2k's avatar
        parry2k
        Icon for Super User rankSuper User

        dphillips it should work, let me double check with slicer you mentioned in your message.