Search code examples
azure-data-explorerkqlkusto-explorer

Kusto - Arithmetic expression cannot be carried-out between DateTime and String


Below Query does not return result gives an error message - Arithmetic expression cannot be carried-out between DateTime and StringBuffer

How do I solve this pls

| extend Time=format_datetime(Testtime,'yyyy-MM-dd h:m:s.fffffff') 
| facet by Time,Status,ID
| extend minutes = (now() - Time)/60
| project minutes, ID
| limit 1```

Solution

  • Time is of type string, and now() is of type datetime

    • The operation now() - Time isn't supported, as the error message suggests: Arithmetic expression cannot be carried-out between DateTime and StringBuffer

    It appears Testtime is of type datetime

    • Did you intend to use now() - Testtime instead?