Forum Discussion

Deleted's avatar
Deleted
Nov 06, 2017
Solved

How to have a time chart show zero for missing/null data.

Hi,   I have a data set that when I use the summarize/bin over a 1 min interval has gaps in the data (hours) and when the timechart renders the graph the line goes directly from the last value in o...
  • Evgeny Ternovsky's avatar
    Nov 07, 2017

    Hi,

     

    Please check out the make-series function to achieve this. For example, instead of saying:

    Heartbeat
    | where TimeGenerated > ago(1d)
    | summarize count() by Computer, bin(TimeGenerated, 1h)
     

    You can say:

    Heartbeat
    | make-series count() default=0 on TimeGenerated in range(ago(1d), now(), 1h) by Computer
     
    The output is a bit different for make-series (you get an array for datetimes and an array for the count for each computer rather than a row combination for each), so if you want the data in the same format that summarize produces, you can do so via mvexpand:
    Heartbeat
    | make-series count() default=0 on TimeGenerated in range(ago(1d), now(), 1h) by Computer
    | mvexpand count_, TimeGenerated

Resources