使用 KQL 生成单行矩阵

Producing a single row matrix using KQL

这是我在 Databricks 中的一项工作的矩阵。我已经裁剪掉了任务名称(通常位于矩阵的左侧。当任务 运行 成功时,绿点显示。我想使用 KQL 重新创建它,而不是简单地拥有所有行有一行,如果所有任务 运行 在给定的一天成功,则点将显示为绿色,如果 1 个或多个任务失败,则点将显示为红色。我有四列数据。时间生成,ActionName(是否通过或失败),table 名称和 jobId(将 jobId 更改为更易于阅读的内容也是理想的 'job1')。我有每个 table 的记录很多个月但只需要一个 2 周的矩阵。如果有人能提供帮助,非常感谢。

// Generation of a data sample. Not part of the solution.
let t = materialize (print table_id = range(1,10), dt = range(startofday(ago(20d)), now(), 1d) | mv-expand table_id | mv-expand dt | extend TimeGenerated = todatetime(dt), TableName = strcat("table_",table_id), ActionName  = dynamic(["Passed","Failed"])[iff(rand()<0.9,0,1)] | where rand() < 0.9);
// Solution starts here.
t
| where TimeGenerated >= startofday(ago(14d))
| extend TimeGenerated = format_datetime (TimeGenerated, 'yyyy-MM-dd')
| summarize result_symbol = iff(countif (ActionName == 'Failed') > 0, make_string(128997), make_string(129001)) by TimeGenerated
| evaluate pivot(TimeGenerated, any(result_symbol))
2022-04-14 2022-04-15 2022-04-16 2022-04-17 2022-04-18 2022-04-19 2022-04-20 2022-04-21 2022-04-22 2022-04-23 2022-04-24 2022-04-25 2022-04-26 2022-04-27 2022-04-28

Fiddle