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

Count number of groups

Status
Not open for further replies.

jrambo

IS-IT--Management
Jan 7, 2003
6
US
Hello.

I am trying to write a report that will tell me how many weeks a certain item was sold by location that sold it. I have a report that first groups by item, then by location, then by week. I do a total to get quantity sold, but can't figure out to get a count of the number of weeks the item was sold.

Anyone know how I could do that?

Thanks in advance for your assistance.
 
Place the week field in the group you want a total for and right click it and select insert summary->Ditinct Count,

It will produce a total for that grouping, and you can now delete the field from the group.

-k kai@informeddatadecisions.com
 
I must be missing something because when I right click on the group header field, I don't get the option for a summary.

Thanks.
 
Are you grouping on a date field that is set to "weekly". You would have to write a formula to do your distinct count, something like:

{Date} - DayOfWeek({Date})

Then do a distinct count of the formula for each group, that will tell you the weeks where sales occured .

But, what do you want to do if the item sold in some weeks but skipped some weeks? Do you want to count the empty weeks? I would guess you do, so I would take the minimum and maximum dates of the reporting period, and divide that by 7. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Sorry, this should be:

Place the week field OF the group you want a total for in the details band and right click it and select insert summary->Distinct Count and you can check for all groups.

It will produce a total for whatever groupings, and you can now delete the field from the details.

Ken brings up a good point, are you counting how long a product was at a location, or how many months that location had sales.

His approach will tell you the earliest and latest month where the product sold, whereas I approached it that you wanted the count of months where a location had a sale.

The methodologies are correct for each case.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top