I have a 'level' value for a tank coming in as a number, which is searchable and aggregatable. Is it possible for me to get a rate over time in which this level is increasing? As the tank nears full it is emptied and this gives a negative rate over a short period of time, can this be ignored?

# Positive flow rate over time for tank level

Hi @thoth,

How are you hoping to visualize this data? If you are doing something like a line chart, you could try filtering to remove any documents where the number is negative.

This sounds like an old physics problem, full of things you may not think about. Does inflow continue while the drain occurs? Is the drain rate consistent? Say the drain is 100/sec, and 1000 is always drained. But the drain takes 11 seconds? That means there was a 100 inflow during the 11 sec drain.

@lukeelmers I just need the metrics, but a gauge might also work. Of note, the documents won't ever be negative, merely the level value will reduce over a short period while the tank is being drained as the level approaches zero. So the rate *at the time while the tank was being drained* would go negative.

@rugenl No open drain while filling so none of that calculus. Just a simple first order derivative on what is coming in.

Is it just a TSVB derivative graph and a filter with value > 0?

I did not know about the derivative graph in TSVB, this seems to be pretty close to what I was looking for. However, putting `value > 0`

in the filter does not seem to work (as my values are never negative). So long as I keep the time between drains this does work. But is it possible for me to ignore the drainings?

Ok, so level is like 1, 2, 3, 4, 5 6, 1. The drain occurred between 6 and 1. I think there is a diff function between values is TSVB, but I'll have to research.

What I thought I remembered was in another product, not Kibana. Maybe someone else will know.