Max value over integral(value) grouped by

If have a query that looks like:

SELECT integral(“value”) / 3600000 FROM “W” WHERE (“entity_id” = ‘solar_pv_power’) AND $timeFilter GROUP BY time(1d) fill(null)

Which gives me a daily value.

Anybody an idea how I can pick out the min / max value during 1 month based on the output of that query?

I know it’s wrong but something like:

Max(integral(value) grouped by (1d)) over a period of 1 month