Kusto:将组汇总并显示为 csv

Kusto : summarize and display the group as csv

在下面的查询中,我想显示该用户的电子邮件 ID 和唯一用户 ID。

customEvents
   //| where customDimensions.UserId == 'Error'
     | where  timestamp > ago(2d)
     | summarize values = dcount(tostring(customDimensions.UserId)) by tostring(customDimensions.email)

数据:

UserId email
1      someone@x.com
Error  someone@x.com
2      other@x.com
3      otherother@x.com
Error  otherother@x.com

预期输出:

someone@x.com.   1, Error
other@x.com      2
otherother@x.com 3, Error 

你可以试试这个:

datatable(UserId:string, Email:string)
[
    '1',     'someone@x.com',
    'Error', 'someone@x.com',
    '2',     'other@x.com',
    '3',     'otherother@x.com',
    'Error', 'otherother@x.com',
]
| summarize UserIds = strcat_array(make_set(UserId), ", ") by Email