Application Insights分析 - 选择每个类别的第一个值

时间:2018-02-26 08:55:55

标签: azure-application-insights ms-app-analytics aiql

我想做一个等效的以下SQL查询 -

(粗略地)

SELECT 
    Name,
    application_Version
    Rank() OVER (PARTITION BY application_Version ORDER BY CountOfEventNamePerVersion)
FROM
    customEvents

假设我轻松获得CountOfCompanyPerVersion字段。我想使用AIQL做同样的事情,但我无法做到这一点。这是我尝试的查询 -

customEvents
| summarize count() by name, application_Version
| project name, application_Version, count_
| summarize x = count(count_) by application_Version
| where x = count_

基本上我想获得每个application_Version最常用的名称。我怎么能这样做?

1 个答案:

答案 0 :(得分:2)

arg_max应该这样做:

customEvents
| summarize count() by Name, application_Version
| summarize arg_max(count_, Name) by application_Version
| order by application_Version 
| project application_Version, Name=max_count__Name