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.
I am looking to do a Cohort analysis of students across multiple grades but the caveat being the students are the same in each grade.
For example, A class of 20 students graduates from Grade 1 to Grade 5 over 5 years. In this cohort, some students leave the class, and some new students join over the years.
I am struggling in finding score averages of students across 5 years of students who have attended all grades from 1 to 5.
Consider the following sample dataset
student_id, grade, score
1,1,100
2,1,80
3,1,85
4,1,90
5,1,93
1,2,100 //Graduate to grade 2
2,2,80
3,2,85
4,2,90
6,2,93 // New students joins, and student #5 leaves
1,3,100 Graduate to grade 3
2,3,80
3,3,85
4,3,90
6,3,93
7,3,87 // New student joins in grade 3
So my cohort should only consider student nos 1 through 4
while doing averages, count of students across grades etc.
Can you advise?
Hi @Deepak6642,
Based on my test, we can take the following steps to meet your requirement.
1. Enter the data and create a calculated table using the formula. Then create relationship between tables based on the student_id.
Table = DISTINCT ( UNION ( SELECTCOLUMNS ( '1', "new", '1'[student_id] ), SELECTCOLUMNS ( '2', "new", '2'[student_id] ), SELECTCOLUMNS ( '3', "new", '3'[student_id] ) ) )
2. Create the measures as below. And create a table visual and make that filterd by Measure.
Measure = IF(MAX('1'[grade]) = BLANK() || MAX('2'[grade])=BLANK() || MAX('3'[grade])= BLANK(), BLANK(),1)
ave 1 = SUMX(ALLSELECTED('1'),'1'[score])/[count]
ave 2 = SUMX(ALLSELECTED('2'),'2'[score])/[count]
ave 3 = SUMX(ALLSELECTED('3'),'3'[score])/[count]
count = CALCULATE(COUNT('Table'[new]),ALLSELECTED('Table'))
For more details, please check the pbix as attached. If it doesn't meet your requirement, kindly share your excepted result to me.
Regards,
Frank
Thank you for the attempt @v-frfei-msft.
However, this is not close to the expected result. The data for the various grades comes from a single table instead of different tables, as listed in the original message.
The dashboard must allow the user to choose a start and end grade, which ought to filter the results and present the same student cohort data as an aggregate.
The resultant graph/table must show the aggregate value across only the students which exist in all the grades from the chosen grade.
Above you can see the plot of aggregates of scores for a subject across the grades. The score aggregate is for students who are the same across all grades over the years. It excludes students who joined in or left in the middle for the selected grade/period.
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 |
---|---|
113 | |
99 | |
75 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |