为 Table 中的每一行添加一个虚拟行

Add a Dummy Row for Each Row in the Table

我有以下查询 every 1 hour

每个 Computer 的 returns %CPU

查询

Perf
| where TimeGenerated > ago(1h) 
| where CounterName == "% Processor Time" 
| where Computer endswith "XYZ" 
| summarize avg(CounterValue) by bin(TimeGenerated, 1h), Computer 

结果


我想为 table 中的每一行附加 Dummy 固定值 除了 TimeGenerated 应与 table 中的上一行相同。预期结果应如下所示。

预期结果

您可以尝试这样的操作(请注意,您需要根据需要明确订购您的记录):

let T = 
    Perf
    | where TimeGenerated > ago(1h) 
    | where CounterName == "% Processor Time" 
    | where Computer endswith "XYZ" 
    | summarize avg(CounterValue) by bin(TimeGenerated, 1h), Computer
;
T
| union (T | extend Computer = "Dummy", avg_CounterValue = 10)
| order by TimeGenerated