Forum Discussion
Pass/fail rate for groups across time
- 1 year ago
Anonymous , Try a measure like
Divide(countrows(filter(Table, Table[Result]= "Pass")) , countrows(Table)) )
Mark that as % column
Hi Anonymous ,
Thanks for reaching out to the Microsoft fabric community forum.
To calculate the percentage of students who passed a course for each group and year, you can follow these steps in Power BI:
1.Create a table with your data: Ensure that your data is correctly loaded into Power BI with the columns ID, Year, Group, and Result.
2.Create a measure for the pass percentage: You need to calculate the pass percentage for each combination of Group and Year. You can create a new measure for this in Power BI.
Use the following DAX formula to create the measure:
Pass Percentage =
VAR TotalStudents = COUNTROWS('Table') -- This counts the total number of students for the specific group and year.
VAR PassedStudents = COUNTROWS(FILTER('Table', 'Table'[Result] = "Pass")) -- This counts the number of students who passed.
RETURN
IF(TotalStudents > 0, (PassedStudents / TotalStudents) * 100, 0)
Plot the data:
Create a Line chart visualization in Power BI. Add Year to the Axis. Add Group to the Legend to differentiate between the groups. Add the Pass Percentage measure to the Values field.
Display percentage labels: To display the percentage on the chart:
Click on the chart to select it. In the Visualizations pane, go to the Format tab. Turn on Data labels to display the percentages on each point in the chart.
If you find this post helpful, please mark it as an "Accept as Solution" and consider giving a KUDOS. Feel free to reach out if you need further assistance.
Thanks and Regards