October 23, 201213 yr I have 2 fields: Year (number), Skunks (Text: yes or no). I want to calculate the ratio of #skunks per year. I created the following summary field: sCountYear = sCount(Year) when sorted by Year sCountSkunks = sCount(Skunks) when sorted by Year I create a subsummary part when sorted by year to calculate the number of surveys done per year, and the number of skunks (no sightings) occurred each year. I need a summary field that will calculate the proportion of skunks per year for each year (sCountYear/sCountSkunks), but I can't make a summary field perform a calculation, and a calculation field isn't going to give me subsummary values by year, only a trailing grand summary. This must be really simple to do but I can't figure it out. Any help would be greatly appreciated.
October 24, 201213 yr To perform a calculation using sub-summary values, you need to use the GetSummary() function. Note. however, that a summary field will count all non-empty fields - so if your field contains either yes or no, all records will be counted alike. If, OTOH, you were using 1 for Yes, 0 (or empty) for No in a Number field, you could divide the sum of the field by the count to get the ratio.
October 24, 201213 yr Author Correct, I oversimplified my example. The skunk field is actually a calculation field that sets a 1 if no sightings occurred and a 0 if at least one sighting occurred. The summary field is then a total of the skunk field as you have shown, not a count field. When I use the GetSummary function I can do: GetSummary (sTotalSkunks; cYear ) or GetSummary (sCountYear; cYear ) but what I want is: GetSummary (sTotalSkunks / sCountYear; cYear ) but I get the error: "Only summary fields are allowed as the first argument in a GetSummary function".
October 24, 201213 yr Try = GetSummary ( sTotalSkunks ; cYear ) / GetSummary ( sCountYear ; cYear ) You'll probably want to subtract that from 1, due to 0 being positive in your system. Note that the counting summary field can count any field that cannot be empty, and neither of the two summary fields needs to be running or restarting.
Create an account or sign in to comment