CSDunn wrote:
Hello,
I have 14 fields on a report that hold integer values. The field names
use the following naming convention: T1Number, T2Number ....T14Number.
I need to get a 'sub total' of all fields as follows:
=Sum([T1Number]) ... =Sum([T14Number])
Then I need to get an average of all fields as follows:
(Grand Total of all fields) / (# of fields where Sum of any field <>
0, or IS NOT NULL)
How can I do this?
Thank you for your help!
CSDunn
Not sure. But I would start off with creating a hidden field that is a
running sum incremented by 1 to get a list of the total record count.
Then I'd create 14 invisible fields that would increment by 1 for each
field value not zero maybe by useing a running sum.
At the end of the record those 14 fields not zero means they had a value
and you could average them.
Or....
You could create another query that uses the same filter and fields of
the report. Ex for column1
Col1 : IIF([Field1] > 0,1,0)
and once you have done that for all 14 fields, make the query a Totals
query and set the Totals row for each column to Sum. You might want to
incorporate the amounts so you have something to calculate on.
Now create a report using this query. THen open up the main report and
drop this report to print at the end.
In your main report, add a column to the recordsource. Ex: Master:"M"
Now make Master your first major group/sort and add a footer. Drop the
sub-report into the footer for Master.
I think this will be much easier to accomplish than a bunch of running sums.