我使用此查询来显示异常:
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)
答案 0 :(得分:1)
你几乎就拥有了你所拥有的东西,你只需要连接两者:
let
+ toscalar
将查询结果定义为数字*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