Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

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!

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @Syndicate_Admin 

 

You can try the following methods.

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

vzhangti_0-1649668398234.png

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.

View solution in original post

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @Syndicate_Admin 

 

You can try the following methods.

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

vzhangti_0-1649668398234.png

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.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.