Calculating totals across multiple rows (or columns) - and then again?

Is it possible to calculate the result of totals across multiple datapoints (rows or columns depending on how I’ve transformed things) and present the result somewhere, and perform further operations against?

I have a handful of problems I’m trying to solve that I think I can work out if I can get my head around a solution for this. And I’m not sure I’ve even asked the question right. But to give one example:

I have a series of data points for space usage in various filesystems, let’s say. For each one, I’m given the amount of space total, space used, and percentage free. I’d like to calculate the percent free across ALL of these filesystems for some sample, and display that single value in a stat panel. But they’re not all the same size. i.e.

time                   name      space total      space used        percent free
2021-02-18 10:41:40    fs1       100GB            20GB              80
2021-02-18 10:41:40    fs2       200GB            20GB              90
2021-02-18 10:41:40    fs2       50GB             20GB              60

I can take the mean of all 3 “percentage free” fields, but that won’t be accurate since the FSes are different sizes. That’d give me 76.7% above, when the actual answer is 82.9%.

I can calculate the total of space total, and total of space used, but I don’t know how to then perform an operation against those results to display in my stat panel (or anywhere else).

Is this possible to do somehow? This seems like the kind of thing that would come up a lot, but so far my search-foo hasn’t found anything definitive. Nothing that was actually answered, anyway.

Anything I can add to make the question more clear?

This topic was automatically closed after 365 days. New replies are no longer allowed.