# How do I calculate and map a depth-weighted sum in ArcView 3.2?

Once you have your data ready to use in ArcView, you'll need to open the table containing the data you want to map. For our example, we will find the average total water-holding capacity for each mapunit.

To start, open the **layer** table and we'll create the water-holding capacity for each horizon. With the comp table open, click on Start Editing in the Table menu. Note that all the field headers change from italics to normal type. Now click on Add Field... in the Edit menu. The following dialog box appears,

giving you the chance to give your new field a name, specify the type of data that will be in the field, and control the width of the field. For this case, use the name *Wat_Cap* and make the field a Number field with 2 Decimal Places. Now highlight the new field and click on the calculator button .

This is a
somewhat complex calculation and certainly requires some explanation.
The *Muid* field is a String and the *Seqnum* field is not so
we need to use the .AsString operator to make it into one. Then, once
you have two strings, the + operator concatenates them. Now we can summarize.
Select the *Musym* field and click on the Summarize button .

In the summarize dialog box we will create two fields, one a summation of the water-holding capacity of each horizon and one holding the *Muid* field which we will use later to combine the results with mapunit-level tables.

Now we join this table to the **comp** table. Create a *Unique* field in the **comp** table as you did in the **layer** table. Then highlight the *Unique* field in both tables. Now, with the comp table active, click on the Join button .

With this modified **comp** table open, click on Start Editing in the Table menu. Now click on Add Field... in the Edit menu. The following dialog box appears,

giving you the chance to give your new field a name, specify the type of data that will be in the field, and control the width of the field. Now highlight the new field and click on the calculator button .

The calculator
allows you to calculate the values for your new field. The formula you
see multiplies the *Sum_Wat_Cap* field (which you calculated earlier
and then joined to the **comp** table) by the percentage of the whole
mapunit that the component occupies. Now we need to summarize two fields
so that we can do another calculation. A longer explanation of the summarizing
procedure is given in this answer. Select
the *Musym* field and click on the Summarize button .

In the summarize dialog box we will create two fields, one a summation of the component percentages and one a summation of the calculation field we just made.

In our new
table, we will need to perform another calculation so Start Editing it
and Add Field... Make sure that the new field is the number type and has
a couple of decimal places. Now highlight the new blank field and click
the Calculate button. This time you want to divide the sum of the *MU_Wat_Cap*'s
by the sum of the component percentages. See if you can get the right
formula without looking at the illustration below.

In order
to map the newly calculated field, we must join the current table to the
table for our view. Choose Stop Editing from the Table menu and then highlight
the *Musym* field. Now open the table for a view . Highlight the *Musym* field in this table as well and then click the Join Tables button. Now you can create a map based on the calculated values. You can see the results below: