Sum all subtag values for a parent tag

What I’m trying to do

I am tracking habits in daily note using inline metadata like [routine/workout : 90], [routine/food:30], [routine/food:25] etc. Then, I am calculating the total time per tag with sum, e.g sum(routinefood), but can’t figure out how to get sum of all the tags, basically sum(routine). Summing all of the subtags will obviously give the parent tag’s value, but then all queries need to be changed if there’s a new tag. So I’m looking for a better way.

Things I have tried

sum(routine) is not giving the sum of all the values of the subtags.