Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Count on a Report (03)

    I have a report and in the report footer I would like to include a count of a certain field. Let's say this field is named "fruit" and the report returns "apples, oranges, bananas and etc". What I would like to do is count the number apples in the report.

    I can obtain the total count of the fruit field by using a build expression of "=count([fruit})

    How would one modify it to include the count of the number of apples?

    Thanks,
    John

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Count on a Report (03)

    Take a look at the DCount function.

    Assuming your record source is a table called table1

    =DCount("[fruit]","<!t>[table1]","[fruit]= 'apple' ")

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Count on a Report (03)

    Another way is
    <code>
    =Abs(Sum([fruit]="apple"))
    </code>
    The expression <code>[fruit]="apple"</code> returns True = -1 if the fruit field equals "apple", and False = 0 otherwise. The Sum of this expression adds -1 for each apple. Abs remove the minus from the result.

Posting Permissions

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