5 Replies Latest reply on Jul 22, 2010 12:39 PM by philmodjunk

# calculating percentage based on value list in a summary report

### Title

calculating percentage based on value list in a summary report

### Post

I've been making no progress on this problem all week, so I'm hoping someone here can help me.

I am trying to use summary reports to do some  very simple analysis on aspects of the data in my DB. What I need to do is calculate the percentage of a specific answer (from a value list) in a particular field out of all the records.

The Filemaker knowledge base has an entry for  "Calculating Response Percentages of a Questionnaire" that would seem to be exactly what I need... but I've been unable to make it work. I am using Filemaker Pro v.9

Each record has a subject ID, and I need to calculate the percent of subjects where field G1_stop is "y". All of the data is in a single table.

Any advice would be immensely appreciated.

• ###### 1. Re: calculating percentage based on value list in a summary report

Try this:

Define a calculation field, cG1_Stop, as IF ( G1_stop = "y" ; 1 ; 0 )

Define a summary field that specifies cG1_Stop using the "Fraction of total" option.

You can format this field as a percent when you place it on your layout.

• ###### 2. Re: calculating percentage based on value list in a summary report

When I use these two fields in a report, they come back as 1/100%. So perhaps the IF calculation is not counting correctly?

There are 12 records where G1_stop = "y", and 350 records total

• ###### 3. Re: calculating percentage based on value list in a summary report

I went back and checked a demo file I made for the fraction of total summary field concept. I'm afraid I made things too complicated here.

Just change the field to 1 so that all records return the value 1 and if you place the fraction of total summary field in a subsummary part and sort to group your records by the value of G1_Stop, you should be able to see percentages for those who answered "y".

Here's the demo file:  http://www.4shared.com/file/V09WRIYL/FractionOfTotal.html

• ###### 4. Re: calculating percentage based on value list in a summary report

Wow, that is incredibly not intuitive, but it does work!

I'm not sure I understand the purpose of the "dummy" field, but being able to see the example of how it all works when you perform the sort helped tremendously.

Thanks so much!

• ###### 5. Re: calculating percentage based on value list in a summary report

Why the dummy field:

Fraction of total summaries will work with other values than just a constant '1'.

You might have values like this in a different database solution:

Value    Fraction of total
2             0.25
3             0.375
1             0.125
2              0.25

The number value one is the right data type to be summed and giving all records the same value makes each individual record the same size fraction of the total.