make_set_if() (aggregation function)
Learn how to use the make_set_if() function to create a dynamic JSON object of a set of distinct values that an expression takes where the predicate evaluates to true.
Creates a dynamic array of the set of distinct values that expr takes in records for which predicate evaluates to true.
Syntax
make_set_if(expr, predicate [, maxSize])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| expr | string | ✔️ | The expression used for the aggregation calculation. |
| predicate | string | ✔️ | A predicate that has to evaluate to true in order for expr to be added to the result. |
| maxSize | int | The maximum number of elements returned. The default and max value is 1048576. |
Returns
Returns a dynamic array of the set of distinct values that expr takes in records for which predicate evaluates to true. The array’s sort order is undefined.
Example
The following example shows a list of names with more than four letters.
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)
Output
| set_name |
|---|
| [“George”, “Ringo”] |
Related content
- Aggregation function types at a glance
- make_set() (aggregation function)
- make_list_if() (aggregation function)
- make_bag_if() (aggregation function)
mv-expand
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.