Power usage group by device

I am quite new to Grafana and I’m struggling with the following query.
Using InfluxDB to get insights in my power consumption. I want to see the kWh consumed per device during the last 24 hours. Get it working fine by using the Derivative function, but now I want to group multiple devices into a single entry on the pie chart panel.
I have created a screenshot with annotations to clearify my issue.

Grafana%20%20%20Domoticz

Found a solution. Can also type a raw influxDB query and use a subquery to get a sum of the grouped results.

My final query is as follows:

SELECT SUM("non_negative_derivative) FROM (SELECT non_negative_derivative(mean("value"), 1d) FROM "Usage" WHERE ("name" = 'kWh-lamp-badkamer' OR "name" = 'kWh-lamp-studeerkamer' OR "name" = 'kWh-lamp-toilet' OR "name" = 'kWh-schemerlamp-boven' OR "name" = 'kWh-lamp-hal') AND time > '2018-12-08' GROUP BY time(1d), "idx" fill(null))