Search code examples
azure-application-insights

Application Insights Summarize with Having clause


I need to summarize an Application Insights query where the count > 1. I don't see any "Having" clause like SQL has. How can I limit my query to only include records when count > 1?

traces
| extend MessageId = tostring(customDimensions.MessageId) 
| summarize Count = count() by MessageId 
| order by Count desc

Solution

  • Once you've called the summarize function Count is treated as a column so you can use a where clause to filter it:

    traces
    | extend MessageId = tostring(customDimensions.MessageId) 
    | summarize Count = count() by MessageId 
    | where Count > 1
    | order by Count desc