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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make a sum without duplicates?

Status
Not open for further replies.

fedleo

Technical User
Oct 26, 2003
11
IT
Hi to all and sorry for my bad english...
I've three tables, one with the item to produce and two with the Orders definitions. The

tables are structured as follow:

TAB_ORDER_1:

{Order} {CNC} {Time}

TAB_ORDER_2:

{Order} {Item}

TAB_ITEM_1:

{Item} {Date}

So, Items are under CNC that are under Orders. If I try to Order for {Order} the reports

works well, if ordered for {Date}, {CNC} and {Time} fields will be repeated as times as the

number of {Item} under. When I try to calculate the total of time it become huge!

Example:

{Order} {CNC} {Time}
1 1 1
1 2 1

sum({Time},{Order})=2

If ordered for {Date}:

{Date} {Order} {CNC} {Time}
10/10/03 1 1 1
10/10/03 1 2 1
10/11/03 1 1 1
10/11/03 1 2 1
10/12/03 1 1 1
10/12/03 1 2 1

sum({Time},{Order})=6!!!

What can I do for have the right total of sum({Time},{Order}) formula?
Thanks to all...
Cheers,

Fedleo
 
In Crystal 8.5, if you do a group for Time/Order or whatever, you can then do running totals for the group, maybe counting just one per group. There's also a function called Distinct Count which might be useful.

Madawc Williams
East Anglia, Great Britain
 
Thanks for your fast reply.
Is hard for me understanding what running totals are becouse I've the Italian version of CR8.5, so I don't know if we are speaking of the same function. I think will be a kind of subtotal, is it?
I have already tryed the distinct count function but it reports just the number of unique fields, not the value...

Can you tell me more?

Thanks,

Fedleo


 
Open the Field Explorer, or else right-click on a field and select [Insert].

Madawc Williams
East Anglia, Great Britain
 
DONE!

Thanks, now all works perfectly!

Cheers
Fedleo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top