Count - chart function
Count() is used to aggregate the number of values, text and numeric, in each chart dimension.
Syntax:
Count({[SetExpression] [DISTINCT] [TOTAL [<fld {,fld}>]]} expr)
Return data type: integer
Argument | Description |
---|---|
expr | The expression or field containing the data to be measured. |
SetExpression | By default, the aggregation function will aggregate over the set of possible records defined by the selection. An alternative set of records can be defined by a set analysis expression. |
DISTINCT | If the word DISTINCT occurs before the function arguments, duplicates resulting from the evaluation of the function arguments are disregarded. |
TOTAL | If the word
TOTAL occurs before the function
arguments, the calculation is made over all possible values given
the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions. By using TOTAL [<fld {.fld}>], where the TOTAL qualifier is followed by a list of one or more field names as a subset of the chart dimension variables, you create a subset of the total possible values. |
Example | Result |
---|---|
Count(OrderNumber) |
Returns the number of rows that could have a value for OrderNumber. All records, even empty ones, are counted.
Information note"0" counts as a value and not an empty cell. However, if a measure aggregates to 0 for a dimension, that dimension will not be included in charts. |
Count(Customer) | Evaluates the number of occurrences in all rows. |
Count(DISTINCT [Customer]) | The DISTINCT qualifier restricts the Count to only evaluate unique occurrences. |
Count(OrderNumber)/Count({1} TOTAL OrderNumber) |
The expression returns the number of orders from the selected customer as a percentage of orders from all customers. |
Count(TOTAL <Product> OrderNumber) |
Returns the number of orders placed on products for the selected customers only. Empty cells are also counted. |