Forum Discussion

ScottAllison's avatar
ScottAllison
Iron Contributor
Sep 20, 2018
Solved

Pivot sort

Using the "pivot" command, there doesn't appear to be a way to sort the columns... am I wrong? 

 

For example:

Table

| project Column_A, SomeValue

| where SomeValue > 0

| evaluate pivot(Column_A, sum(SomeValue))

In this example, the columns pivoted from "Column_A" will show up in no discernible order. Is there a way to sort the columns?

 

8 Replies

  • Hi Scott,

    I believe you're right and the order is not controlled. I'll forward that question to verify with the developers.

    Also, please note the documentation of pivot mentions that since the resulting schema is based on  changing result-sets, it is not a stable source for automation processes:

    "The output schema of the pivot plugin is based on the data and therefore query may produce different schema for any two runs. This also means that query that is referencing unpacked columns may become 'broken' at any time. Due to this reason - it is not advised to use this plugin for automation jobs."

    • ScottAllison's avatar
      ScottAllison
      Iron Contributor

      Interesting. I'm using this for a dashboard tile at the moment.

      • Noa Kuperberg's avatar
        Noa Kuperberg
        Icon for Microsoft rankMicrosoft

        Hey, verified that and indeed no way to control the order of the pivot-based columns :/