BanksySan
BanksySan

Reputation: 28500

Application Insights order by aggregate

I have the following query:

customEvents
| summarize count(datepart("Second", timestamp) ) 
    by toint(customMeasurements.Latency)

This is counting the number of seconds past the minute and grouping it by an integer Latency.

How do I add an order by operator to this to order by these columns?

Upvotes: 2

Views: 2224

Answers (1)

BanksySan
BanksySan

Reputation: 28500

In order to do this you need to alias the columns.

Aliasing columns is performed by prefixing the value with column_alias=.

customEvents
| summarize Count=count(datepart("Second", timestamp) ) 
    by Latency=toint(customMeasurements.Latency)

Then we can reference the columns by their aliases:

customEvents
| summarize Count=count(datepart("Second", timestamp) ) 
    by Latency=toint(customMeasurements.Latency)
| order by Latency asc nulls last 

Upvotes: 2

Related Questions