Search code examples
azureazure-data-explorer

Kusto - rendering columnchart does not honor data row order


I have following data and I am rendering columnchart with it but columnchart does not create graphs in the same order as data i.e. first column as July then August and then so on.

Can someone help me here on how to ensure order in columnchart

datatable (Month: string, total_core_hours: long) [
    "July",long(2000000),
    "August",long(3361305),
    "September",long(2478058),
    "October",long(2869816),
    "November",long(1663719),
    "December",long(5039456),
    "January",long(22773168),
    "February",long(10974652),
    "March",long(27346583),
]
| project Month, total_core_hours
| render columnchart

enter image description here


Solution

  • Following worked for me, by converting string to datetime which brings natural order to data:

    datatable (StartDate: datetime , total_core_hours: long) [
        datetime(2021-10-01),long(2869816),
        datetime(2021-11-01),long(1663719),
        datetime(2021-12-01),long(5039456),
        datetime(2022-01-01),long(22773168),
        datetime(2022-02-01),long(10974652),
        datetime(2022-03-01),long(27346583),
    ]
    | extend formattedStartDate = format_datetime(StartDate, "yyyy-MM")
    | project formattedStartDate, total_core_hours
    | render columnchart
    

    enter image description here