2

When I use bin(timestamp, 1m) and generate a timechart of it, null values generate a straight line. How can i treat missing values as zeros?!?

John Gardner
  • 24,225
  • 5
  • 58
  • 76
Leonardo
  • 10,737
  • 10
  • 62
  • 155

2 Answers2

4

Another option is to use the make-series operator instead of summarize, with default=0.

Make-series documentation

make-series creates a series that can be analyzed using advanced time-series functions. It's a bit clunkier than summarize, but offers other advantages.

Grzegorz Smulko
  • 2,525
  • 1
  • 29
  • 42
Assaf Neufeld
  • 703
  • 5
  • 10
0

Your best bet is to use iif() in conjnction with an isnull() or isempty(). Mind you if your pulling from a custom metric you will need to make sure you're value is set to the same type.

requests | extend mycustomvalue = toint(todynamic(customDimension).customDuration) | extend mycustomduration = iif((isnull(mycustomvalue) or isempty(mycustomvalue)), 0.0, mycustomvalue)

James Davis - MSFT
  • 1,736
  • 10
  • 12
  • that only exists if you have rows. if you have gaps in time where there are no requests, this still returns no rows. `make-series` is probably the better answer if you're doing a timechart and there might be gaps. – John Gardner Jul 31 '17 at 22:42