Overview
COUNT_AGG function is used to perform distinct count (not empty) for the specified dimension (dragged into the analysis area). The calculation field will make dynamic adjustment automatically when you switch the analysis dimension.
Syntax | COUNT_AGG(Array) | Based on the current analysis dimension, this function returns the count of the field. The generated results are listed in a data column. The number of rows in the data column is consistent with that in the current analysis dimension. |
Parameter | Array | The parameter must be a non-aggregate expression. |
Notes
The function supports one parameter of any type for real-time data.
Example
If the dimension field in the horizontal axis is Day, the value returned by the calculation field COUNT_AGG(Sales Volume) is the count of sales for each day.
If the dimension field in the horizontal axis is Month, the value returned by the calculation field COUNT_AGG(sales) is the count of sales for each month.
For example, you can calculate the number of contract signings each year in Contract Information. Drag Contract Signing Date into the horizontal axis and set the grouping method to Year, as shown in the following figure.
1. Create a calculation field named Contract Quantity, enter COUNT_AGG(Contract ID), and click OK, as shown in the following figure.
2. The following figure shows the result.
3. You can drag Count into the analysis area directly to get the same result, as shown in the following figure.
Further Reading
Count(Number of Rows) = COUNT_AGG(1). For details, see Count.