Sum Certain tag values?

Hey there!

I’ve got some questions around how to do some math on some data, hoping the community here can provide some guidance.

Use case: I’ve got power meters hooked up to some circuits in my electrical panel. Telegraf reads the devices via REST API, and pumps the data into InfluxDB 2.0. Some circuits are 240v “dual-pole”, meaning I need to sum() both poles to get the total wattage on the circuit.

So here’s an example of the data:

#group,false,false,true,true,false,false,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string
#default,_result,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,ct_name
,,0,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,0,ct_value_watts,watts,ct0_0
,,1,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,0.96,ct_value_watts,watts,ct0_1
,,2,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,781.26,ct_value_watts,watts,ct0_2
,,3,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,1172.73,ct_value_watts,watts,ct0_3
,,4,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,15.06,ct_value_watts,watts,ct0_4
,,5,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,1.04,ct_value_watts,watts,ct0_5

I’d like to combine ct0_0 & ct0_1 as well as ct0_2 & ct0_3, to end up with:

#group,false,false,true,true,false,false,true,true,true
#datatype,string,long,dateTime:RFC3339,dateTime:RFC3339,dateTime:RFC3339,double,string,string,string
#default,_result,,,,,,,,
,result,table,_start,_stop,_time,_value,_field,_measurement,ct_name
,,1,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,0.96,ct_value_watts,watts,ct01summed
,,2,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,1953.99,ct_value_watts,watts,ct23summed
,,4,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,15.06,ct_value_watts,watts,ct0_4
,,5,2022-06-26T21:31:37.794467184Z,2022-06-26T21:36:37.794467184Z,2022-06-26T21:36:35Z,1.04,ct_value_watts,watts,ct0_5

Any guidance on how I can accomplish this? Thanks!