0

谁能给我一个示例代码,我如何在饼图中呈现这些数据?

我想要在每个类别中计算是否是最新的计算机。我也在这里得到重复的“计算机”条目,因为它们在不同的日期有几个条目,我只想要最后一个状态。

示例数据 - 图片

4

1 回答 1

0

这是一个类别的选项(按summarize其他键替换组):

datatable(computer:string, featureUpdateStatus:string, qualityUpdateStatus:string, securityUpdateStatus:string, lastScan:datetime)
[
    "c1", "not up-to-date", "up-to-date", "up-to-date", datetime(2020-07-07 14:03:50),
    "c1", "not up-to-date", "up-to-date", "up-to-date", datetime(2020-07-07 15:02:59),
    "c2", "not up-to-date", "up-to-date", "up-to-date", datetime(2020-07-06 11:44:40),
    "c2", "not up-to-date", "up-to-date", "up-to-date", datetime(2020-07-07 16:18:01),
    "c3", "up-to-date",     "up-to-date", "up-to-date", datetime(2020-07-07 13:39:09),
    "c3", "up-to-date",     "up-to-date", "up-to-date", datetime(2020-07-07 12:26:45),
    "c4", "not up-to-date", "up-to-date", "up-to-date", datetime(2020-07-07 16:18:01),
    "c4", "up-to-date",     "up-to-date", "up-to-date", datetime(2020-07-07 13:39:09),
]
| summarize arg_max(lastScan, *) by computer
| summarize count() by featureUpdateStatus
| render piechart
于 2020-07-10T15:15:51.477 回答