make_set_if() (aggregation function)
Returns a dynamic (JSON) array of the set of distinct values that Expr takes in the group, for which Predicate evaluates to true.
- Can be used only in context of aggregation inside summarize
Syntax
make_set_if (Expr, Predicate [, MaxSize])
Arguments
- Expr: Expression that will be used for aggregation calculation.
- Predicate: Predicate that has to evaluate to
truefor Expr to be added to the result. - MaxSize is an optional integer limit on the maximum number of elements returned (default is 1048576). MaxSize value cannot exceed 1048576.
Returns
Returns a dynamic (JSON) array of the set of distinct values that Expr takes in the group, for which Predicate evaluates to true.
The array's sort order is undefined.
Tip
To only count the distinct values, use dcountif()
See also
make_set function, which does the same, without predicate expression.
Example
let T = datatable(name:string, day_of_birth:long)
[
"John", 9,
"Paul", 18,
"George", 25,
"Ringo", 7
];
T
| summarize make_set_if(name, strlen(name) > 4)
| set_name |
|---|
| ["George", "Ringo"] |
Feedback
Submit and view feedback for