I’m having some issues with KQL queries where I want to retrieve the value of some custom dimension that I’ve logged in custom events. That custom dimension contains a datetime value, and I want to write a query which does something with that datetime (for instance, get the max datetime), so I want to retrieve it as a datetime. However , when retrieving a custom dimension using KQL, the value of the custom dimension is returned as a dynamic data-type, so I want to convert it to a datetime, and that’s where things become interesting. Consider this dataset (which exists of only one row atm)
As you can see, I have a customDimension with the name ‘LastTelemetryReceivedTimestamp’ which contains a datetime. However, when I want to get the customevent with the max LastTelemetryReceivedTimestamp per vesselId, like this:
I get this error:
We receive this error because the customDimension value is retrieved as dynamic. Fine you might think, just convert it explicitly to datetime like this:
But as you can see, now I receive ‘null’. The todatetime function outputs null if it was not able to convert the given value to a datetime.
However, if I do this:
This just works. Does anyone has a good idea about this, or knows how this can be solved ? How can I successfully convert a dynamic value to a datetime value ?