3 Replies Latest reply on Oct 7, 2011 4:05 PM by joelande

# Calculate percentage summary field - using only a specific value

### Title

Calculate percentage summary field - using only a specific value

### Post

I have a database looking at student test scores.

There is a record for each student test.

I have a layout that is using three sub-summary layout parts:

a) teacher name

b) pass

c) achievement

Pass can either be "pass" or fail"

I have a summary field called "count" that sums the student ID, and have it on each sub-summary layout, so it reports each sub-category of performance.

I want to calculate the PERCENTAGE of students who PASSED for each teacher.

I created a calculation field "performance_value" that looks like this:

Round ( GetSummary ( count ; Pass )/GetSummary ( count ; Teacher ) ; 3 )*100

This works for most cases, because I sort the pass field by a value list definition, placing "pass" at the top.

However, if a teacher doesn't have ANY students that pass, it incorrectly states that the teacher had 100% pass, because it is grabbing the first summary value that it finds, and in this case it represents the number of students who failed.

So how can I more accurately/specificaly calculate the value showing percent of students that passed?

• ###### 1. Re: Calculate percentage summary field - using only a specific value

Limit your found set or related records to only those with "pass" in the pass field.

If this is a summary report, perform a find for just those records. If you are referring to this field from a related table, include the Pass field in the relationship so that only students that have passed are included in the relationship. This typically requires adding a calcualtion field with a constant value of "pass" to use in this relationship.

• ###### 2. Re: Calculate percentage summary field - using only a specific value

Hmm, had another thought.  as what I suggested messes up the second part of the calculations (the count of total students).

Is this a value you are putting in a sub summary part sorted by teacher?

Try:

If ( Pass = "Pass" ; Round ( GetSummary ( count ; Pass )/GetSummary ( count ; Teacher ) ; 3 )*100 ; 0 )

• ###### 3. Re: Calculate percentage summary field - using only a specific value

The IF statement did it!

Thanks!

(the other option - performing a find for a subset of the records - would not have been useful, because I wanted to report on all of the teachers' pass/fail and achievement level breakdowns at once)