转置列名称和值 KQL/Kusto/Data Explorer

Por*_*ten 1 kql azure-data-explorer

我有一个数据集,其中包含许多带有日期的列。我想只返回列名称和日期,然后按日期排序。在 Excel 中,我将通过转置数据然后排序来完成此操作。我怎样才能在 KQL 中完成同样的任务?

let T1 = datatable (Date1:string, Date2:string, Date3:string, Date4:string, Date5:string, Date6:string, Date7:string, Date8:string, Date9:string, Date10:string, )[
"2021-11-3", "2021-11-4",
"2021-11-5", "2021-11-6",
"2021-11-7", "2021-11-8",
"2021-11-9", "2021-11-10",
"2021-11-11", "2021-11-12"];
T1
Run Code Online (Sandbox Code Playgroud)

结果:

Date1       Date2       Date3       Date4.........   
2021-11-3   2021-11-4   2021-11-5   2021-11-6.....  
Run Code Online (Sandbox Code Playgroud)

期望的结果:

DateType  Date
Date1     2021-11-3
Date2     2021-11-4
Date3     2021-11-5
Date4     2021-11-6
...       ...
Run Code Online (Sandbox Code Playgroud)

Yon*_*i L 5

您可以使用该narrow()插件:https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/narrowplugin

datatable (Date1:string, Date2:string, Date3:string, Date4:string, Date5:string, Date6:string, Date7:string, Date8:string, Date9:string, Date10:string)
[
    "2021-11-3", "2021-11-4", "2021-11-5", "2021-11-6", "2021-11-7", "2021-11-8", "2021-11-9", "2021-11-10", "2021-11-11", "2021-11-12"
]
| evaluate narrow()
| project DateType = Column, Date = Value
Run Code Online (Sandbox Code Playgroud)
日期类型 日期
日期1 2021-11-3
日期10 2021-11-12
日期2 2021-11-4
日期3 2021-11-5
日期4 2021-11-6
日期5 2021-11-7
日期6 2021-11-8
日期7 2021-11-9
日期8 2021-11-10
日期9 2021-11-11