有没有办法将 "flatten" KQL 结果放入汇总列中?

Is there a way to "flatten" KQL results into summary columns?

给定以下数据集,是否有一种simple/efficient方法可以使用 KQL 生成如下所示的摘要table,理想情况下 不知道实际情况预先使用的颜色(即列名是根据遇到的数据值生成的)?

datatable ( name: string, colour: string )[
  "alice", "blue",
  "bob", "green",
  "bob", "blue",
  "alice", "red",
  "charlie", "red",
  "alice", "blue",
  "charlie", "red",
  "bob", "green"
]

+---------+------+-------+-----+
| name    | blue | green | red |
+---------+------+-------+-----+
| alice   |    2 |     0 |   1 |
| bob     |    1 |     2 |   0 |
| charlie |    0 |     0 |   2 |
+---------+------+-------+-----+

Pivot 插件

datatable ( name: string, colour: string )[
  "alice", "blue",
  "bob", "green",
  "bob", "blue",
  "alice", "red",
  "charlie", "red",
  "alice", "blue",
  "charlie", "red",
  "bob", "green"
]
| evaluate pivot(colour, count(), name)
name blue green red
alice 2 0 1
bob 1 2 0
charlie 0 0 2

Fiddle