Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
4 years ago
Solved

The calculated measure does not add up

Hello everyone!

I need urgent help.

My database is of the grades of a school, for which I must count students who lost each of the subjects for a certain period.

The calculation of the final grade (whether you lose or not) is the average of several grades assigned to the student in the same subject.

Below I show the student's grades in mathematics in year 11. To know if he lost it or not I must get his average and if that average is greater than 2.0 the matter passes, otherwise he loses.

nataliaguzman02_0-1649443259943.png

My problem is that when I add the column (Score_Code) to a table-type visualization, it correctly places the student's average in the subject. As shown in the FinalScore column of the following table.

nataliaguzman02_1-1649443425553.png

But after that I need to know for that subject in that grade how many students lost, so I created a measure that assigns 0 when the student is above or equal to 2 and 1 when he is below, as seen in the image above in the column "Measure", where in that table he assigns it correctly.

But having a general table of the subject with the count of the aspects evaluated (the number of notes taken in the subject), count of students of the course, and the average of grades comes out correctly, but when adding the measure does not make me the sum of the 1, to know how many of them lost.

nataliaguzman02_2-1649443545086.png

Someone can help me please!

  • Hi, Syndicate_Admin 

     

    You can try the following methods.

    Measure2 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            [Measure] = 1
                && [Subject] = SELECTEDVALUE ( 'Table'[Subject] )
        )
    )
    

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • v-zhangti's avatar
    v-zhangti
    Icon for Community Support rankCommunity Support

    Hi, Syndicate_Admin 

     

    You can try the following methods.

    Measure2 =
    CALCULATE (
        COUNTROWS ( 'Table' ),
        FILTER (
            ALL ( 'Table' ),
            [Measure] = 1
                && [Subject] = SELECTEDVALUE ( 'Table'[Subject] )
        )
    )
    

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.