auralsculptor Posted January 18, 2007 Posted January 18, 2007 I need to sum values from a field (A) based on the value of another field in a different table (X). I can do this by "finding" X=1, sum A but I want this in a calculation. In fact I need to show three values in one place if X=1, Sum A if X=2, sum A if X=3, sum A can someone show me a calculation that will do this?
Søren Dyhr Posted January 18, 2007 Posted January 18, 2007 Well your question isn't particular easy to get the point in, so I've made a stab at what I think you're after, utilizing contemporary filemaker approaches.... --sd test.zip
auralsculptor Posted January 22, 2007 Author Posted January 22, 2007 Thanks, I think I did not explain well I am trying to create a custom function that will do this to no avail so far I need a "conditional sum" of four fields but only if a related field has a specific value. Kind of like a sum on a found set, without the "find". I would have several of these fields for various values of the related field The logic works like this sum (field1; field2; field3) if (tableA::fieldX = "1") I found a "SumConditionalFields" custom function, but could not adapt it to my needs ....
comment Posted January 22, 2007 Posted January 22, 2007 It's still not very clear. Perhaps: If ( tableA::fieldX = "1" ; Sum ( field1 ; field2 ; field3 ) )
auralsculptor Posted January 22, 2007 Author Posted January 22, 2007 No, the field to be summed and the "if" field form part to the same record ... I have attached the file conditional_calc.fp7.zip
Jdawg Posted February 1, 2007 Posted February 1, 2007 (edited) I hope this isn't thread hijacking. I'm working on a similar problem, and when I use something like this If ( relatedtable::fieldX = "1" ; Count ( related records); 0 ) It only evaluates if fieldX in the first related record is "1", and then it counts all related records not just the ones that are coded "1". That's not what I want. I want it to step through the related records only counting the ones that are coded as "1". Edited February 1, 2007 by Guest
Recommended Posts
This topic is 6566 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 accountSign in
Already have an account? Sign in here.
Sign In Now