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 | COUNTD_AGG(Array) | Based on the current analysis dimension, this function returns the distinct 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 Array parameter must be the result returned by a non-aggregate function formula, which can be a calculation result of an indicator field, dimension or indicator field and a common formula. |
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 COUNTD_AGG(Sales Volume) is the distinct count of sales for each day.
If the dimension field in the horizontal axis is Month, the value returned by the calculation field COUNTD_AGG(Sales Volume) is the distinct count of sales for each month.
For example, if you want to count the number of customers of different contract by Contract Information, there are two implementation methods.
Create the calculation field Number of Clients with the COUNTD_AGG function. Enter COUNTD_AGG(Client ID), as shown in the following figure.
Drag the indicator into the analysis area, as shown in the following figure.
Select Convert to Indicator to convert Customer ID from a dimension to an indicator, as shown in the following figure.