Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Academic course pass rate

Hello every one,

I am new to Power BI because my institution just switched to it recently. I need help creating a measure that calculates course pass rate. This would represent the percent of courses marked with A, B, C (these grades are considered as pass grades). Courses are assigned letter grades of A,B, C, D, F or W. Below is an idea of what my table columns look like

Student ID      Course                Grade

1                   ENGL 101              B

2                   ENGL 341              D

2                   MATH 101            C

3                  PSYC 31                 A

3                  SOCI 123               F

 

Basically with this example I need to calculate the percent of pass grades (A, B, C) over the the total count of grades.

Any help will be greatly appreciated.

  • Anonymous's avatar
    Anonymous
    7 years ago

    Hi Anonymous 

    Create a measure to retreive pass/total.

    PASS_RATE_M =
    VAR TOTAL_COUNT =
        COUNTROWS ( T22 )
    VAR PASS_COUNT =
        CALCULATE (
            COUNTROWS ( T22 ),
            FILTER (
                T22,
                T22[Grade]
                    IN {
                    "A",
                    "B",
                    "C"
                }
            )
        )
    RETURN
        PASS_COUNT / TOTAL_COUNT

     

    Cheers!
    A

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    Create a measure to retreive pass/total.

    PASS_RATE_M =
    VAR TOTAL_COUNT =
        COUNTROWS ( T22 )
    VAR PASS_COUNT =
        CALCULATE (
            COUNTROWS ( T22 ),
            FILTER (
                T22,
                T22[Grade]
                    IN {
                    "A",
                    "B",
                    "C"
                }
            )
        )
    RETURN
        PASS_COUNT / TOTAL_COUNT

     

    Cheers!
    A

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you for the quick response. I used the statement and only have to change the table name but I get the error message below:

      Pass Rate = COUNTROWS('By Program')
      VAR Pass Count = CALCULATE(COUNTROWS('By Program'), FILTER('By Program', [Grade] IN {"A", "B", "C", "P"}))

      Return Pass Rate/[Pass Count]

       

       

      However, I decided to create two separate measures, one that adds pass grades:

      Pass Count = CALCULATE(COUNTROWS('By Program'),FILTER('By Program', [Grade] IN {"A", "B", "C", "P"}))

      and another that adds all grades: All Grades = COUNTROWS('By Program'), then do Pass Count/All Grades to get my desired results. 

      What are my doing wrong in  the error message in order to have all three measures into one? 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous 

        Looks like your VAR name contains a spcae which is not alowed.

        Pass Rate --> Pass_Rate

        Pass Count --> Pass_Count

        etc.

         

        Thanks!
        A

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    assuming you're choosing all grades as having equal value, then these are really just pass/fail percentages.  I'd create a column from the letter grades, which is a "pass/fail" column.  put your condition of a/b/c there, and make it a pass or fail value. (or a binary column called "pass?" to be even faster)

     

    then you can create a measure to calculate pass %.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Mathur I'm trying to get the percent of courses students passed with a grade of A, B, or C on the total grades. I have a sample data layout above.

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Super User

        Hi,

        What exact result do you want to see?  Show the expected result in a simple Table.