【问题标题】:Kusto - Conditional formating in KustoKusto - Kusto 中的条件格式
【发布时间】:2021-12-03 00:22:57
【问题描述】:

我有一个 Kusto 查询,其结果为表格格式。但是当我应用条件格式时,它不会按照我创建的规则以正确的颜色突出显示单元格。

例如--我有一个带有duraion的列并设置如下规则

Green if > 0
Blue if > 1
Yellow if > 5
Red if > 20
----------------```

But I see some of the cell that has value 2.5 is highlighted in Red . where the color should be blue. When I delete the rule for Red, the cell changes to Yellow color. Is there a solution for this or right way to apply rule.Thanks. This is projecting a wrong alert. Thanks for any inputs.

Screenshot of column with formating

[![enter image description here][1]][1]
some of the values are in red which should be in blue as per the rules (refer screenshot below)

You can see the rules below
[![enter image description here][2]][2]


  [1]: https://i.stack.imgur.com/uEFUx.png
  [2]: https://i.stack.imgur.com/9lpmh.png

datatable (AvgDuration: string, AvgDurationWin: string, AvgDurationLinux: string, MinDuration: string, MaxDuration: string) [
    "0.0666 s","0.0732 s","0.0525 s","0.015 s","0.684 s",
    "0.0663 s","0.0712 s","0.0535 s","0.015 s","0.851 s",
    "0.0649 s","0.0700 s","0.0521 s","0.014 s","0.674 s",
    "25.050 s","17.614 s","18.428 s","13.133 s","56.284 s",
    "0.0982 s","0.1074 s","0.0805 s","0.021 s","1.078 s",
    "0.0982 s","0.1046 s","0.0814 s","0.021 s","1.041 s",
    "0.0982 s","0.1058 s","0.0813 s","0.021 s","1.106 s",
    "0.0987 s","0.1089 s","0.0814 s","0.022 s","1.039 s",
    "0.0992 s","0.1074 s","0.0817 s","0.022 s","1.032 s"
]

【问题讨论】:

  • 我不能复制这个,你能附上所有规则和列值的屏幕显示
  • 感谢您的回复。我已在原始问题中上传了图片。
  • 如果您可以将示例结果集包含为数据表,这将有助于重现这一点。 (在网格中选择适用范围,右键选择“复制为数据表”)
  • 用示例数据表更新了我的原始问题。当我像在屏幕截图链接中那样应用条件格式时,它不能按预期工作。谢谢。
  • 数据值是字符串,条件格式需要数字。

标签: azure-data-explorer kql kusto-explorer


【解决方案1】:

这是因为您的值是字符串。如果您想以秒为单位进行计算并具有条件格式,您可以执行以下操作:

  1. 使用 round() 函数限制点后的位数
  2. 在列名中注明单位

例如:

| summarize AvgDurationInSeconds = avgif round((Duration, Tests == "Success"), 2)

【讨论】:

  • 谢谢..下面更新的是我使用的查询,它可以工作。 | summarize AvgDuraionInSeconds = round (avgif (Duration, Tests == "Success"), 2)
猜你喜欢
  • 1970-01-01
  • 2021-07-15
  • 2021-10-25
  • 1970-01-01
  • 2021-11-17
  • 2019-10-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多