Sum array values

I have an array that looks like:

0: object
time: "2020-06-18T23:00:00.000Z"
consumption_value_inc_vat: 0.498036
1: object
time: "2020-06-18T23:30:00.000Z"
consumption_value_inc_vat: 0.4657905
....................

How can I sum the "consumption_value_inc_vat"?
Preferably in JSONata.

assuming that that is msg.payload, try $sum(payload.consumption_value_inc_vat)

1 Like

Thanks Paul, I had a brainfart trying to do this, overthinking!!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.