Fill(linear) or fill(previous) not working into the future if having sum of multiple series in query

I have a question regarding an influxQL query of the below pattern where individual lines are drawn into the future but when I add sum() function, that is not projected.

  • What Grafana version and what operating system are you using? 9.1.6

  • What are you trying to achieve?
    I want to have the Total Space of 3 arrays summed and the last value drawn into the future to end-time.

  • How are you trying to achieve it?
    I have a query for the needed values , grouped by tag “array”, and then I sum those with
    SELECT sum(mean) FROM (SELECT ... ) GROUP BY time($__interval) fill(linear)

  • What happened?
    If I add the SELECT SUM(mean) FROM… part, it breaks the drawing into the future.

  • What did you expect to happen?
    The last value (present) of SUM being drawn into the future until dashboard end time.

  • Can you copy/paste the configuration(s) that you are having problems with?
    SELECT mean("capacity") AS "Total space" FROM "$rp"."array_capacity" WHERE ("array" =~ /^$array$/) AND $timeFilter GROUP BY time($__interval), "array"
    This works and draws lines into the future with last value.

SELECT sum( "Total space") FROM (
SELECT mean("capacity") AS "Total space" FROM "$rp"."array_capacity" WHERE ("array" =~ /^$array$/) AND $timeFilter GROUP BY time($__interval), "array" 
) GROUP BY time($__interval)  fill(linear)

If the first and last lines are not in the query, 3 individual lines are drawn for the 3 arrays and they are filled 1 year in the future if the time in grafana is set to that.
When I add the sum function, it breaks the lines into the future.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
  • Did you follow any online instructions? If so, what is the URL?