Mapping a table with increasing values

I currently have a table with timestamps and a success/non-success field. Whenever there is a succes for a timestamp I want to make a graph which increases by 1 for each success timestamp. Having the values on the y axis and the date on the x axis. I have tried with the map function, but there I can’t increase the value, i.e. I can only get a table with the timestamp and then just 1 for the values, but not increasing. And a count function also does not help me as I need each value with the timestamp.

Want something like this:

Using influxdb 2.0 with flux.

Hi @Luis,

Can you share your full Flux query so we can see what you’re currently trying?

Hi @mhall119,

This is the query:

from(bucket: "my-bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) =>
    r._measurement == "signups" and
    r._field == "status" and 
    r._value != "FAILEDDUPLICATE"
  )

  |> map(fn: (r) => 
    ({ r with _value: 1}) <-- I would like this value to increase by +1 every time, because now I just get a list of ones. That way I can get a graph like the one shown above. 
  )

Maybe you have a better idea for this and I am taking the wrong approach?

Thanks.

Just to clarify, it sounds to me like you have an event stream and you are trying to convert it into a counter. The event stream is “event happened” and you are trying to count the events and increase a counter when that event passes some kind of filter. Is that correct?

I am going to look into if there is a way to go this direction. There’s nothing that comes off on the top of my head but if this is the intention I’m sure that we can come up with a function to do this.

I think you might be looking for using cumulativeSum() after the map.