Forum Discussion
Steven_Su
Mar 06, 2022Copper Contributor
Fill zero in the table for timechart
Hi, I would like to create a timechart for high daily number of incident in the past 7-day. However, not everyday has high incident. How could I fill the 0 into the result if that day has no high inc...
Clive_Watson
Mar 06, 2022Bronze Contributor
Take a look at make-series, something like this example
SecurityIncident
| where Severity == "High"
| make-series count(), default=0 on TimeGenerated from ago(7d) to now() step 1d by IncidentNumber
| project TimeGenerated, count_
| render columnchart
Steven_Su
Mar 07, 2022Copper Contributor
Hi Clive, since there are multiple IncidentNumber generated within a single day, the chart will be like this. How could I just make each day a single bar instead of showing multiple colors of portions? Thank you.
- Clive_WatsonMar 07, 2022Bronze Contributor
SecurityIncident | where Severity == "High" | make-series count(), default=0 on TimeGenerated from ago(7d) to now() step 1d // by IncidentNumber | project TimeGenerated, count_ | render columnchart with (title = "Total Incidents per Day")
- Steven_SuMar 08, 2022Copper Contributor
Yes the approach works. But one more question, if the data is 0 in the past 7 day, is it possible to still post the graph instead of showing the message "The query returned no results."? Thanks