dcountif() (aggregation function)
Returns an estimate of the number of distinct values of Expr of rows for which Predicate evaluates to true.
- Can be used only in context of aggregation inside summarize.
Read about the estimation accuracy.
Syntax
dcountif (Expr, Predicate, [, Accuracy])
Arguments
- Expr: Expression that will be used for aggregation calculation.
- Predicate: Expression that will be used to filter rows.
- Accuracy, if specified, controls the balance between speed and accuracy.
0= the least accurate and fastest calculation. 1.6% error1= the default, which balances accuracy and calculation time; about 0.8% error.2= accurate and slow calculation; about 0.4% error.3= extra accurate and slow calculation; about 0.28% error.4= super accurate and slowest calculation; about 0.2% error.
Returns
Returns an estimate of the number of distinct values of Expr of rows for which Predicate evaluates to true in the group.
Example
PageViewLog | summarize countries=dcountif(country, country startswith "United") by continent
Tip: Offset error
dcountif() might result in a one-off error in the edge cases where all rows
pass, or none of the rows pass, the Predicate expression