Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Juggernaut

Calculating sum of instances when field returns certain value

Featured Replies

  • 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?

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?

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.