Jump to content

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?

Link to comment
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?

Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.