How to take the sum of a filtered query

I am trying to take the sum of the query results returned. The challenging part is that the query returns a value per “metric” whose sum returns “no data”

SELECT sum(“sample”) FROM (
SELECT
last(value) as sample

FROM “”
WHERE “metric” =~ // and $timeFilter
GROUP BY “metric”
fill(null)
)

@akoumpas what does your unformatted data look like from the returned query?