Kusto grouping as in UI

Viewed 72

How do I create the grouping shown below in the query (not using the UI).

enter image description here

1 Answers

Below are 2 different options

1)

datatable(firstname:string, lastname:string)
[
    "John", "Miller",
    "John", "Smith",
    "Mike", "Stone",
    "Harry", "Keller"
]
| summarize properties = make_list(pack("firstname", firstname, "lastname", lastname)) by firstname
firstname   properties
---------   ----------
John        [{"firstname":"John","lastname":"Miller"},{"firstname":"John","lastname":"Smith"}]
Mike        [{"firstname":"Mike","lastname":"Stone"}]
Harry       [{"firstname":"Harry","lastname":"Keller"}]
datatable(firstname:string, lastname:string)
[
    "John", "Miller",
    "John", "Smith",
    "Mike", "Stone",
    "Harry", "Keller"
]
| summarize properties = make_list(strcat(firstname, " ", lastname)) by firstname
firstname   properties
---------   ----------
John        ["John Miller","John Smith"]
Mike        ["Mike Stone"]
Harry       ["Harry Keller"]
Related