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

问题描述 投票:0回答:1

我想做一个相当于以下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最常见的名称。我怎样才能做到这一点?

azure-application-insights ms-app-analytics aiql
1个回答
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 
© www.soinside.com 2019 - 2024. All rights reserved.