Results 1 to 3 of 3

Thread: A counting problem [RESOLVED]

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    A counting problem [RESOLVED]

    Let me see if I can 'splain this properly....

    I am using CR9, by the way.

    I have many records. Each record, in addition to other data, contains a date field and a shift field.

    I have a group on the date. No problem. I have the report count how many days of production we had by doing a distinct count on the date field and placing it on the report footer. That works.

    Now it gets dicey. I need a count of the shifts worked. For instance, on day one, I might have 12 records, but they are spread over 3 shifts. So that day would count as 3 shifts (not 12). The report footer needs to have the total count of shifts for all days ( the 3, not the 12). I can't use a distinct count or I will get "3". I can't use a count or I get "35" (when it should have been "18"). I have tried creating a variuos summary fields in the date group, but I can't summeraize those for the report totals.

    Any ideas?
    Last edited by Pasvorto; Apr 22nd, 2004 at 01:00 PM.

  2. #2
    Addicted Member
    Join Date
    Jan 2001
    Location
    MPLS
    Posts
    187
    If I understand correctly, try this. Create a summary field on the shift field with distinct count as the operator and place that in the date group. This will give you the number of shifts for each day as you've already tried.

    To get the grand total shifts over all the days for the report total, create two formulas as follows. First create a formula, say "shift calc" to sum each of the date group distinct counts.

    Shared numberVar shifttotals := shifttotals + DistinctCount ({db.shiftfield}, {@DateGroup});

    Place this formula in your date group foooter next to your summary field. This acts as a running total field.

    Finally create a formula to display the grand total result of the "shift calc" formula you created. So create a formula, say "shift total display" as

    Shared NumberVar shifttotals;

    Place this formula in your report footer and you should have the grand total distinct count your looking for?

  3. #3

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951
    Perfect!!! You guys are g-o-o-o-d...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width