Crystal Reports for Eclipse Designer Guide

DistinctCount

Description
Enables you to get a distinct count of the values that appear in your report.
Overloads
  • DistinctCount (fld)
  • DistinctCount (fld, condFld)
  • DistinctCount (fld, condFld, cond)
  • DistinctCount (x)
  • Returns
    Number
    Action
    Enables you to get a distinct count of the values that appear in your report. For example:
  • If a sales report includes all orders made by customers, you can compute the total number of distinct customers that appear in the report (a grand total distinct count), excluding any duplicate records. If a customer made more than one order, the duplicate occurrences of that customer are ignored.
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the number of distinct customers per group (in this case, per state). Any customers that made more than one order and appear more than once in a group are only counted once.
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the number of distinct customers in each group based on a particular change in the date or Boolean field (in this case, the number of customers that placed orders each month). If a customer placed more than one order within the month, duplicate instances of that customer are ignored.
  • If you specify a set of individual values, you can compute the number of distinct values in the set. Duplicate values in the set are only counted once. For information on this kind of distinct count, see Array summary functions.
  • Examples
    DistinctCount({customer.REGION})
    Counts the number of different States represented in the Region field, ignores any repetitions.
    DistinctCount({customer.CITY}, {customer.REGION})
    Calculates the number of different cities in each State group.
    DistinctCount({orders.CUSTOMER ID}, {orders.ORDER DATE}, "weekly")
    Counts the number of different customers contacted, follow up contacts are excluded. Customers are separated into groups whenever the value in the Date field changes to a new week.
    DistinctCount([1,3,5,3,2,5])
    Returns 4. Counts the number of distinct values in the array. Duplicate values are ignored.
    Using this function in a formula forces the formula to be evaluated at print time.
    For more information on evaluation time considerations, see Evaluation Time.
    Comments
    DistinctCount counts the number of distinct values in a field. Duplicate values are ignored.



    SAP BusinessObjects
    http://www.sap.com/sapbusinessobjects/
    Support services
    http://service.sap.com/bosap-support/
    Product Documentation on the Web
    http://help.sap.com/