### DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Basic and Crystal syntax.

##### Arguments

- fld is any valid database or formula field that can be evaluated by the function.
- condFld is a field used to group the values in fld by.
- cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
- x is an array of values that can be evaluated by the function being used.

##### Returns

Fractional 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. For information on this kind of distinct count, see SummaryFunction (fld).
- 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. For information on this kind of distinct count, see SummaryFunction (fld, condFld).
- 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. For information on this kind of distinct count, see SummaryFunction (fld, condFld, cond).
- 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 (x).

##### Examples

The following examples are applicable to both Basic and Crystal syntax:

`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.

The following example is applicable to Crystal syntax:

`DistinctCount([1,3,5,3,2,5])`

Returns 4. Counts the number of distinct values in the array. Duplicate values are ignored.

Note: 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 functions.

##### Comments

DistinctCount counts the number of distinct values in a field. Duplicate values are ignored.

Seagate Software, Inc. http://www.seagatesoftware.com Please send comments to: techpubs@seagatesoftware.com