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!

Counting Number of System sales

Status
Not open for further replies.

Woodyuk

IS-IT--Management
Aug 22, 2003
59
GB
Hello, not sure how to do this so thought I would ask on here.

Im pulling out sales information, and I want to count the number of sales where 2 products have been sold on the same sale ID.

eg I want to count how many sales are done product1s are sold with product2s:

SaleID Item Qty
1 Product1 2
2 Product1 3
2 Product2 2
3 Product2 1

So looking at the above the report should tell me only one sale was sold with product1 and product2 on it.

Im using Crystal 10, I have tried grouping by sales ID and then trying doing some werid sums like if statements, but I cant do it.

Please help!
 
Sorry, bit of a language barrier, try rephrasing.

"I want to count how many sales are done product1s are sold with product2s"

Also, rather than saying that a report will tell you something, please take the time to show the output required, I doubt that you're looking to use speech software, but we could do it... ;)

Not posting software version, database, expected output will generally just waste everyone's time, please be thorough and think through your requirements.

Group by SaleID, then use the 3 formula method:

Group by SaleID formula:
whileprintingrecords;
numbervar Cnt:=1

Details formula;
whileprintingrecords;
numbervar Cnt;
Cnt:=Cnt+1

Group Footer Formula:
whileprintingrecords;
numbervar Cnt;
Numbervar TotCnt;
If Cnt > 1 then
TotCnt:=TotCnt+1

Now in the report footer you can display the total count of sales with more than one product using:

Group Footer Formula:
whileprintingrecords;
Numbervar TotCnt

-k
 
Or you could group on {table.saleID} and then go to report->selection formula->GROUP and enter:

distinctcount({table.product},{table.saleID}) > 1

Then insert a running total where you select distinctcount of {table.saleID}, evaluate for each record, reset never. Place this in the report footer.

-LB
 
Sorry for the langauage thing, trying to do 2 things at once doesnt work!

As mentioned im using Crystal 10.

What I should of said is I want to count sales where 2 products have been sold on, but they are specific products

eg I want too see if Product1 and product2 have both been sold on the same sale. If product1 has been sold with product3 (and thats it) I wouldnt count it. If Product1, Product2 and product3 were all done on the same sale I would count that sale as product1 and product2 were on it
 
Okay, then create a formula like this {@Prods}:

if {table.product} = "Product1" then 1 else
if {table.product} = "Product2" then 1000 else 0

Then go to report->selection formula->GROUP and enter:

sum({@Prods},{table.salesID}) >= 1001 and
remainder(sum({@Prods},table.salesID}),1000) <> 0

Then use the running total I mentioned earlier to count the displayed sales IDs.

-LB
 
Lbass, that looks like the one. I will try it however we are having "system" problems at the moment.

It makes sense, and I think I will be able to use it, even though they have now changed how the report should work.

I shall post a reply once I have tried it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top