# Calculating sum of instances when field returns certain value

This topic is 5663 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

• Newbies

"Tendency" is a calculation field that returns one of three text symbols; let's say: A, B, or C. I already have this field correctly set up.

However, I'm having difficulty constructing another calculation field that will give the percentage of instances when "Tendency" equals either A or C in the entire layout.

so (sum of records when Tendency = A) + (sum of records when Tendency = C) / Get(TotalRecordCount)

or instead of Get(TotalRecordCount) I could use the last value of the number field "Instance"

I suspect I need some combination of a Case or If function with the Sum function; but I'm new to FMP and tho I've spent hours in the help files (obviously written more as a reference for someone already familiar with databases, then as an introduction for the beginner), I'm at a loss as to how one constructs a function giving the total number of instances in a database when a field returns a certain value

Would someone be so kind as to shed some light on this for me?

##### Share on other sites

I have two cases where I am attempting to calculate the sum with a criteria.

The first was similar to yours with set values for the field with the values. I solved it with additional calculated fields, one for each possible value, If (Tendency = "A", 1, 0). Next field If (Tendency = "B", 1, 0), and If (Tendency = "C", 1, 0). The summation of these new fields gave me the totals I was looking for.

Now I have a new problem. Well same problem, with no set values. If anyone has any ideas?

##### Share on other sites

This topic is 5663 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account