I have a report that is doing a running total manually ie:
shared numbervar Amount:={#Amount};
shared numbervar TotalAmount:=Amount+TotalAmount;
Amount;
I then have a separate formula attempting to calculate the average by dividing the amount by the total amount:
whileprintingrecords;
shared numbervar TotalAmount;
if {@Amount}<>0
then
{@Amount}/TotalAmount;
Despite using whileprintingrecords, the Total Amount is not displaying the actual total, it's displaying the total at the time Amount is printed. So what am I doing wrong?
Edit: Both formulas are in the footer of a group. As a test I even removed the groups, and had them both in the details section, with no groups present. I even removed the running total to try and take it out of the mix, with no change.
I'm trying to calculate the percentage each amount contributes to the total amount. So the report would look like
Amount | %
$100 | 50%
$50 | 25%
$50 | 25%
____
$200
Instead the report ends up looking like:
Amount | %
$100 | 100%
$50 | 33%
$50 | 25%
____
$200