# Calculation on a running total

Question asked by KiwiKim25 on Dec 2, 2010
Latest reply on Dec 2, 2010 by KiwiKim25

### Title

Calculation on a running total

### Post

I'm doing a fairly basic program that has a few calculations.  I have half of it down pat but need some help on the rest.

Here's what I have:  We are looking at video of a rat.  When the rat enters sideA, and when it leaves sideA, we write those times down (Example 0:05:15 to 0:08:10).  These are organized by day, but there are multiple videos per day.

I have table 1 set up for basic information (date, time etc).  There is a portal to table 2. This includes 2 columns for "Time in" and "Time out".  Next to that I have a column that subtracts the two to give us the Time Spent in SideA.  This all works great.

In another portal to table 2  I have 2 columns.  Video ID Number and Video Length.  We're all good there.

Here is where I hit my snags.  My final portal to table 2 has 2 columns.

Total Time in SideA, with the calculation   Sum ( Time Spent In SideA)

Percentage of Time in SideA, with the calculation   Sum ( Time Spent In Side Instance ) / Total Video Time Length

I also have a field that is not showing: Total Video Time, with the calculation   Sum ( Video Time Length )

My problem is in the last portal with 2 columns, I actually want just one box with a running total of the Total Video time, Time in SideA and Percentage of Time in SideA.  What I'm getting is each time I enter data in the other entry places, this column makes a new line too (so it shows multiple field entries).  How do I fix this so it's just one box with my final calculations?

I tried changing the portal for those 2 columns to 1 line, but it doesn't update the information when I enter new data in the first 2 portals.  What am I doing wrong?

Here is a screen shot of what it looks like.  The bottom right columns are the ones I'm trying to fix (the numbers/times are random ones I typed to see if it worked).