Kusto query to add the names of links clicked, in a separate column

Solution 1:

Looks like you want to join the pageViews table with the customEvents table on operation_id, while from the latter you only want to take the list of names.

This should be achieved by two steps:

  1. Create a mapping from operation_id to the list of names
  2. Use lookup to join the data from pageViews and the mapping from the previous step

This is how you do it (I omitted columns that are not used for the join, just to make the example simpler):

// Synthetic data - don't copy this part
let pageViews =
    datatable (timestamp:datetime, operation_Id:string, client_City:string)
        [
            datetime(2022-01-20T06:50:10.343Z), "5cd8b209da4a4062ac11e73a52914e4f", "Chicago"
        ];
let customEvents =
    datatable (timestamp:datetime, operation_Id:string, name:string)
        [
            datetime(2022-01-20T06:50:18.873Z), "5cd8b209da4a4062ac11e73a52914e4f", "Spotify",
            datetime(2022-01-20T06:50:19.928Z), "5cd8b209da4a4062ac11e73a52914e4f", "Youtube"
        ];
// This is the real query
let namesPerOperationId =
    customEvents
    | summarize make_set(name) by operation_Id;
pageViews
| lookup (namesPerOperationId) on operation_Id

Result:

timestamp operation_Id client_City set_name
2022-01-20 06:50:10.3430000 5cd8b209da4a4062ac11e73a52914e4f Chicago [
"Spotify",
"Youtube"
]