Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear community, I have been searching for an answer to this for a couple of hours but I can't really find a solution/starting point.
I'm trying to show the latest 3 known scores of every student in a table/matrix. The data is as follows:
Exams
StudentID | ExamScore | ExamDate |
1 | 100 | 1/13/2019 |
2 | 90 | 1/13/2019 |
1 | 80 | 2/16/2019 |
1 | 95 | 3/10/2019 |
1 | 70 | 4/12/2019 |
3 | 60 | 3/10/2019 |
Students
StudentID | StudentName |
1 | Jack |
2 | John |
3 | Mary |
4 | Stevano |
5 | Jamal |
The goal of the visual is to inform a teacher/coach about the latest 3 scores of each student, so the teacher for example knows whether a student needs extra attention. I had the following table / matrix visual in mind:
Student | Score 1 | Score 2 | Score 3 |
Jack | 80 | 95 | 70 |
John | 90 | ||
Mary | 60 |
I really appreciate all the help.
Solved! Go to Solution.
So i would do this by first adding a grouped rank colunm to the exam table that will give a number in decending order to each exam split by student ordered by date desc
i would then add three colunms to the student table that calulcate the score based on the id and the rank number from above
you can repeat this formula three times to givce you the 3 required scores by changing the value for R
i have made a PBIX file that should do what you are asking for
Proud to be a Super User!
So i would do this by first adding a grouped rank colunm to the exam table that will give a number in decending order to each exam split by student ordered by date desc
i would then add three colunms to the student table that calulcate the score based on the id and the rank number from above
you can repeat this formula three times to givce you the 3 required scores by changing the value for R
i have made a PBIX file that should do what you are asking for
Proud to be a Super User!
@AnthonyTilley Sorry, back again 😞 The customer requirements changed a bit and now he wants to just show the latest 3 exam scores in a year so the result should be as follows:
Student | Exam 1 score | Exam 2 score | Exam 3 score |
Jack | 70 | 95 | 80 |
John | 90 | ||
Mary | 60 |
As the filter should take year into account I created a column for Year in the exam table and changed the RankX to be:
Rank = RANKX( FILTER( Exams, Exams[StudentId]=EARLIER(Exams[StudentId]) && Exams[ExamDateYear]=EARLIER(Exams[ExamDateYear]) ), Exams[ExamDate],Exams[ExamDate],ASC,Dense)
But I can't seem to figure out how to proceed from here to get the required results.
you will need to make the following changes
in the exam table you need a year colunm and change the rank formula
Proud to be a Super User!
@AnthonyTilleyThanks you for your reply, but how can I change the formula to show this instead:
Student | Score 1 | Score 2 | Score 3 |
Jack | 80 | 95 | 70 |
John | 90 | ||
Mary | 60 |
So the logic should select the last 3 exams based on the date and then show the first exam of the last 3 in the first column the second last in the second column and the last in the last column.
Updeted the file again
there may be an easier way to do this that im not seeing but for me i would introduce a second rank colunm in the exam table that will filp the rank after it is calculated.
in this file there is a rank and rank2 colunm
and the colunms in students now pull rank2
Proud to be a Super User!
Works like a charm! Thank you so much for taking the effort and time to help out Anthony!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |