Azure log with percentiles with avg

Microsoft

I currently am using wire data and am able to do the following

WireData

| where ProcessName contains "outlook" and ( RemoteIP matches regex "^10\\..*$") and TimeGenerated > ago(7d)

and Computer == "computername"

| summarize AverageKb = (avg(TotalBytes)/1024) by bin(TimeGenerated, 5m)

| render timechart

 

This gives me the avg, and another query is this

 

WireData

| where ProcessName contains "outlook" and ( RemoteIP matches regex "^10\\..*$") and TimeGenerated > ago(7d) and Computer == "computername"

| summarize ["KB"] = percentile(TotalBytes/1024,95) by bin(TimeGenerated, 5m)

| render timechart

 

 

What I am trying to do is get the avg KB for the 95th percentile of usage so I want to exclude the top 5% highest values from the avg. 

thanks in advance

2 Replies

Hi,

 

The trick to do this is to use avgif function that allow you to include in the average calculation only values in the right range. The crux is that you have to calculate the range beforehand.

 

Here is an example using the Perf table:

 

let CounterP95=toscalar(
    Perf
    | where CounterName == "% Free Space"
    | summarize percentile( CounterValue, 95)
    );
Perf
| where CounterName == "% Free Space"
| summarize avgif(CounterValue,CounterValue<CounterP95)

 

Hope it helps,

Meir :>

thx let me try that