Flux Map function - Sum and concatinate

Hello all,
I am trying to print in grafana panel :slight_smile:
(actual_arrival+actual_departure) / (scheduled_arrival + scheduled_departure)
Here, “/” will concat both.

In my query, I am getting output as below :slight_smile:
Can someone help me to do sum and concatinate values in map function, or any otherway .

Many Thanks !

from(bucket: “dashboard”)
|> range(start: -24h, stop: now())
|> filter(fn: (r) => r["_measurement"] == “MyMeasurement”)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: “_value”)
|> group(columns: ["_measurement",“nature”,“terminal”,“station”], mode:“by”)
|> last(column: “scheduled_arrival”)
keep(columns: ["_value",“scheduled_arrival”,“actual_arrival”,“scheduled_departure”,“actual_departure”])
|> reduce(
fn: (r, accumulator) => ({
actual_arrival: r.actual_arrival + accumulator.actual_arrival,
scheduled_arrival: r.scheduled_arrival + accumulator.scheduled_arrival,
actual_departure: r.actual_departure + accumulator.actual_departure,
scheduled_departure: r.scheduled_departure + accumulator.scheduled_departure

    identity: {actual_arrival: 0, scheduled_arrival:0, actual_departure: 0, scheduled_departure: 0}

|> keep(columns: [“actual_arrival”,“actual_departure”,“scheduled_arrival”,“scheduled_departure”])
|> map(fn: (r) => ({r with _value: string(v:r.actual_arrival)+"/"+string(v:r.scheduled_arrival)}))

Hi @sarojmicrosoft,

I don’t have enough Influx knowledge to help you answer this directly, but I can tell you that Grafana 8 will get released in two weeks, and there will be much greater support for Flux…