Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
New to Power BI. I have 20 students that have to take 4 classes to meet training requirements
I'm trying to calcuate the percentage of students that have completed 0,1,2,3 or 4 classes
Is there a way to could the total column based on criteria (0,1,2,3,4) and divide by the total number of students.
Thanks in advance
| Class #1 | Class #2 | Class #3 | Class #4 | Total | ||||
| Student #3 | 1 | 1 | 1 | 1 | 4 | |||
| Student #13 | 1 | 1 | 1 | 3 | ||||
| Student #4 | 1 | 1 | 2 | |||||
| Student #5 | 1 | 1 | 2 | |||||
| Student #8 | 1 | 1 | 2 | |||||
| Student #15 | 1 | 1 | 2 | 0 class | 40% | |||
| Student #17 | 1 | 1 | 2 | 1 class | 20% | |||
| Student #19 | 1 | 1 | 2 | 2 class | 30% | |||
| Student #2 | 1 | 1 | 3 class | 5% | ||||
| Student #7 | 1 | 1 | 4 class | 5% | ||||
| Student #11 | 1 | 1 | ||||||
| Student #12 | 1 | 1 | ||||||
| Student #1 | 0 | |||||||
| Student #6 | 0 | |||||||
| Student #9 | 0 | |||||||
| Student #10 | 0 | |||||||
| Student #14 | 0 | |||||||
| Student #16 | 0 | |||||||
| Student #18 | 0 | |||||||
| Student #20 | 0 |
Solved! Go to Solution.
You need to unpivot the data in the query editor so it has the following columns
student name, class name, value
when you have these three columns, you can just drag the columns Into your report and get the total column (put value column in the values section). Then write some measures such as
classes completed = sum(table[value])
total students = distinctcount(table[student name])
0 class = divide(sumx(values(table[student name]),[classes completed]=0),[total students])
repeat for 1,2 etc
Hi @Stadeo
Add the following Measure.
See the attached file as well
Percentage = COUNT ( TableName[Total] ) / COUNTROWS ( ALL ( TableName ) )
You need to unpivot the data in the query editor so it has the following columns
student name, class name, value
when you have these three columns, you can just drag the columns Into your report and get the total column (put value column in the values section). Then write some measures such as
classes completed = sum(table[value])
total students = distinctcount(table[student name])
0 class = divide(sumx(values(table[student name]),[classes completed]=0),[total students])
repeat for 1,2 etc
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 31 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |