question

bogdandr avatar image
0 Votes"
bogdandr asked HimanshuSinha-MSFT answered

KQL query issues with dynamic and datetime

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)
79548-image.png

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:
79576-image.png
I get this error: 79517-image.png
We receive this error because the customDimension value is retrieved as dynamic. Fine you might think, just convert it explicitly to datetime like this:
79566-image.png
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:
79529-image.png
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 ?

azure-analysis-services
image.png (101.0 KiB)
image.png (82.1 KiB)
image.png (35.4 KiB)
image.png (122.0 KiB)
image.png (44.4 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

79497-kusto.pdf



Not sure why it has taken that format on the post. I've added the question in this PDF as well, it should be more explanatory

0 Votes 0 ·
kusto.pdf (180.9 KiB)

1 Answer

HimanshuSinha-MSFT avatar image
0 Votes"
HimanshuSinha-MSFT answered

Hello@bogdandr asked · 13 hours ago,
Thanks for the ask and using the Microsoft Q&A platform .

Have you tried this ? At this time I am not having the datest to try this on myside .

 todatetime(tostring(customDimensions.LastTelemetryRecievedTimestamp)) 

Please do let me know how it goes .
Thanks
Himanshu
Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.