# Using a Running Total in a Formula in the Details Section of a Crystal Report

I'm new to Crystal Reports so this likely has an obvious answer but I haven't been able to put two and two together yet by searching on the internet. Using Crystal2008 if that makes a difference.

I'm trying to build a report that will function as an invoice. It needs to display the tax broken down by Location. My table has the locations in one column and an amount in a second column. I've group the report by location (one location can have multiple records). I have the amount in the details section.

I've suppressed one location (99999) because it's the tax 'location'. It has an amount which is the total tax for all location.

I've created a running total to show the subtotal (#Subtotal) for each location (placed in the group footer). I've created another running total that sums all of the amounts (#Total) (placed in the report footer). I need to be able to create a formula that does #Subtotal/#Total*Tax to calculate the tax for each location. I want to place this location below the #Subtotal in the group footer. But it doesn't work because the running total hasn't added all of the amounts yet.

How do I calculate the total, if Crystal hasn't read through all the records yet? Is there a better way to achieve what I'm trying to do?

Edit to Answer Nick's Question:

The issue is that the running total hasn't finish calculating the full total of the report. Let's say I have Locations A, B and C. I create a running total (#Total) in the Report Footer which displays the total for A, B and C. When I go to use #Total in the formula in the Group Footer, it has only calculated the total for A at the end of Group A.

1. Create a "Formula Field" (Not a running total field) called Total
2. In the Formula Editor grab "Functions" (Middle divider) -> Summary -> Sum -> Sum(fld) and put it in the editor portion
3. Drag the "Amounts" that you want the total of and and put it in the Sum function
4. Put this formula field in the footer (It should display the total I believe you want)