Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't figure out calculation 1

Status
Not open for further replies.

Ladyazh

Programmer
Sep 18, 2006
431
US
I am swept by formulas all of a sudden.

prod qty proqty goqty
aa1 1 10 120
aa1 2 9 120
aa1 0 8 120
aa2 0 20 10
aa2 5 50 10

I have prod field trimmed so everything for aa goes into same group. So my group is Trimmedprod.
I need to get on Report:
If {qty}=0 then prodqty
If {qty}<>0 then prodqty

Then I need to get total for aaa 19+50=69
Then I need to have gogty 120 +10 = 130
Then I need 130-69

I have group So my group is Trimmedprod
Report looks like:
prod proqty0 proqtynot0 totalproqty goqty short
aa 28 69 97 130 33

I have everything done except i can not make a 'short' column to calculate correctly.
Please, advice.
 
Add a record sort on {table.prod}. Then insert a running total {#gogty} for goqty where you sum {table.goqty}, evaluate on change of field {table.prod}, reset on change of group {@Trimmedprod}. Then create a formula {@short}:

{#goqty} - sum({table.proqty},@Trimmedprod}

Note that you said originally you wanted the difference between 130 and 69 but then later indicated it was the difference with the total of the proqty field.

-LB
 
A-MA-ZING!!!
The only thing that makes me glad i was not that far but i gave up when {#goqty} - sum({table.proqty}) did not wark and i had started creating a sub report.
I forgot to add @Trimmedprod and THANKS you very much for solving it for me.
THANKS
 
One more, sorry.
And now to summarize this one
{#goqty} - sum({table.proqty},@Trimmedprod}
should I create a sub?
 
If you need to summarize this at the report level, create a separate running total like the last one, with no reset. Then use a formula like this;

{#newrt}-sum({table.proqty})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top