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

Application Insights analytics - Select first value per category

我想执行与以下 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 中最常见的名称。我该怎么做?

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