1

我使用这个查询来显示异常:

exceptions
| where application_Version == "xyz"
| summarize count_=count(itemCount), impactedUsers=dcount(user_Id) by problemId, type, method, outerMessage, innermostMessage
| order by impactedUsers 

如何查询受特定异常影响的用户百分比?

我会通过这个查询检查所有用户:

customEvents
| where application_Version == "xyz" 
| summarize dcount(user_Id) 
4

1 回答 1

4

你几乎已经有了你所拥有的,你只需要将两者联系起来:

  1. 使用let+toscalar将查询结果定义为数字
  2. 在你的查询中引用它(我曾经*1.0强制它是一个浮点数,否则你会得到 0,并且曾经round得到 2 个小数,但是你需要调整它)

进行查询:

let totalUsers = toscalar(customEvents
 | where application_Version == "xyz" 
 | summarize dcount(user_Id));
 exceptions
 | where application_Version == "xyz"
 | summarize count_=count(itemCount), 
      impactedUsers=dcount(user_Id), 
      percent=round(dcount(user_Id)*1.0/totalUsers*100.0,2) 
   by problemId, type, method, outerMessage, innermostMessage
 | order by impactedUsers 
于 2018-04-04T21:23:57.013 回答