# How to create variables for summary calculations

This topic is 6534 days old. Please don't post here. Open a new topic instead.

## Recommended Posts

• Newbies

FM Pros:

I am an FM newby and I have a problem related to reporting on a group that represent a fraction of all records, while still included summary info from the total of all records.

My report shows a fraction of all inventory records, but on each sub-summary line needs to include information summarized from the total.

Specifically, I am showing transactions within a date range, and totaling weight shipped for those transaction within that date range, thus the sub-summary provides the net weight shipped in/out during the specified period.

Now I need to have the total for all of the transactions up through the detail date range (a previous balance) as well as a total of all transactions thus providing three lines on the subsummary: Previous Balance (Weight available as of the beginning of the detail range), In/Out (Weight shipped in or out within the detail date range) and Total (Weight currently available, which is the total of the weight field for all records).

I understand the process of showing all records and using a script to loop through and do the calculations. What I am not clear on is how to create the appropriate variables to store all of these values, since I assume that I will need to keep some type of array to store the individual calculations for each subsummary band on the report. I don't know in advance how many subsummary sections there will be on the report. Can someone help illuminate?

Kevin

##### Share on other sites

One generic way of handling situations like this is to use "Self-Join" relationships.

To access all fields using a self-join regardless of the found set, make a relationship between a global # with true and a # field with true (I set true to auto-enter 1), I'll call it Foo.True. Get the grand total of SomeNumber using the calc: Sum(Foo.True::SomeNumber). This works regardless of the Found Set.

Using the same technique, you can define subsets of the data using other relationships.

##### Share on other sites

This topic is 6534 days old. Please don't post here. Open a new topic instead.

## Create an account

Register a new account