Count() returns the number of values aggregated in expression, as defined by a group by clause.
Return data type: integer
|expr||The expression or field containing the data to be measured.|
|distinct||If the word distinct occurs before the expression, all duplicates are disregarded.|
Examples and results:
Add the example script to your app and run it. Then add, at least, the fields listed in the results column to a sheet in our app to see the result.
To get the same look as in the result column below, in the properties panel, under Sorting, switch from Auto to Custom, then deselect numerical and alphabetical sorting.
LOAD * inline [
] (delimiter is '|');
LOAD Customer,Count(OrderNumber) as OrdersByCustomer Resident Temp Group By Customer;
As long as the dimension Customer is included in the table on the sheet, otherwise the result for OrdersByCustomer is 3, 2.
Given that the Temp table is loaded as in the previous example:
LOAD Count(OrderNumber) as TotalOrderNumber Resident Temp;
Given that the Temp table is loaded as in the first example:
LOAD Count(distinct OrderNumber) as TotalOrderNumber Resident Temp;
Because there are two values of OrderNumber with the same value, 1, and one null value.