Leonardo
Leonardo

Reputation: 11389

Application Insights - How to sort by custom dimension

I would like to sort the results of my query according to customDimension.MyCustomProperty which is present in all entities and is a number. How can I do that?

Upvotes: 46

Views: 47258

Answers (2)

Yannick Meeus
Yannick Meeus

Reputation: 5890

What I would suggest is first extending your result set with your customDimension. Then you'll have to cast your new column to either a string, an int or a double. The reason for this is that customDimensions is considered a dynamic column

A quick example:

traces
| extend sortKey = toint(customDimensions.MyCustomProperty)
| order by sortKey asc

The casting options are:

  • tostring()
  • toint()
  • todouble()

If you want to remove the sorting key after the actual sort, you can project-away the new column.

Upvotes: 83

Related Questions