Varun Sharma
Varun Sharma

Reputation: 2761

Kusto - Get Average and Count in the same row

Using Kusto, I want to write a query to see the average duration of events and total count of those events as well. I am able to do it in two queries like this but is it possible to do this in 1 query?

dependencies
| where type == 'SQL' and operation_Name == 'something'
| summarize avg(duration) by data
| order by data asc

dependencies
| where type == 'SQL' and operation_Name == 'something'
| summarize count() by data
| order by data asc

This is giving me what I want in two separate results. For example I get this:

A 1.2
B 1.4
C 4.5

and

A 5
B 90
C 78

but what I want is this

A 1.2 5
B 1.4 90
C 4.5 78

Upvotes: 5

Views: 4105

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44991

See summarize operator for syntax

T | summarize [SummarizeParameters] [[Column =] Aggregation [, ...]] [by [Column =] GroupExpression [, ...]]

dependencies
| where type == 'SQL' and operation_Name == 'something'
| summarize avg(duration), count() by data
| order by data asc

Upvotes: 5

Related Questions