Milo_Dev
Milo_Dev

Reputation: 415

Kusto - Conditional formating in Kusto

I have a Kusto Query where the result is in the table format. But when I apply the conditional format it does not highlight the cell with the correct color as per the rule I created.

for example--I have a column with duraion and set the rule as below

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 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

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"
]

Upvotes: 2

Views: 3551

Answers (1)

Avnera
Avnera

Reputation: 7608

This is because your values are string. If you want to calculate it by seconds and have conditional formatting you can do the following:

  1. Use the round() function to limit the number of digits after the dot
  2. Indicate the unit in the column name

For example:

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

Upvotes: 2

Related Questions