influxDB Subquery not working

Hi,
My photovoltaics Daily-Yield is stored in influxdb.
I now wanted to visualize the yields in longer time ranges, for example weeks or month.
Since I think this isn’t possible without a subquery, I tried it this way.
The Subquery is getting the latest daily-yield data of every day, the main query is summing this daily yield data to the longer timerange, in this example weeks:

SELECT SUM("value") FROM (SELECT LAST("value") FROM "mqtt_consumer" WHERE ("topic" = 'home/garden/test3') AND $timeFilter GROUP BY time(1d) fill(null)) WHERE $timeFilter GROUP BY time(1w) fill(null)

Unfortunately, his query doesn’t reply any data.
Does anyone have an idea what’s wrong in this query? I can’t find my mistake(s)…

If someone has the same problem, this way it’s working:

SELECT sum("value") FROM (SELECT last("value") as "value" FROM "mqtt_consumer" WHERE ("topic" = 'mytopic') AND $timeFilter GROUP BY time(1d) fill(0)) GROUP BY time(1w) fill(null)