You've got columns in there you can use as flag. You could write something like:
IF [col4]='Total' THEN [col5] END
That will only return the lower level aggregate. After that it's just a matter of what sort of viz you're trying to build.
Are the calcualtions in col7, col8 is the exact calcuation you will be using on your real data too ?
Because from What I see, the calculation is just to get the value if the col5, col6 are equal.
And then sum it, based on sub category. Right ?