Max_over_time with sum

I am using prometheus to manage multiple smart PDU’s with the snmp explorer, I need to track max power usage for different devices connected to these PDU’s. I have a list of PDU’s along with the outlets they are connected to. When I run my query i would like to sum/combine up the outlets used for a specific device then take the max power over a period of time. I can get the sum/combine working and the max_over_time on a entire pdu but when i try to use them together they fail. This is through http so its needed to all be in 1 request.

Working for sum/combine outlets:
sum(pdu_outlet_sensor_value{sensorType=“apparentPower”, instance=“”,outletId=~“22|23|19”})

Trying to get max over time:
max_over_time(sum(pdu_outlet_sensor_value{sensorType=“apparentPower”, instance=“”,outletId=~“22|23|19”})[2d])

Error executing query: parse error at char 125: range specification must be preceded by a metric selector, but follows a *promql.AggregateExpr instead

Any help would be appreciated.