From various examples I've hacked together a pretty neat aggregation function which gives me an overview on which activity (strings in G) I've spent non-billable work hours (numbers in E) or billable (numbers in E) hours of work.
=query(E35:G232, "select G, sum(E), sum(F) where G != '' group by G order by sum(F) desc label G 'activity', sum(E) 'work hours', sum(F) 'billable hours'")
So this might give me:
Development | 5 | 12
Marketing | 14 | 5
Admin | 0 | 2
What I've tried, but so far failed, to do now is getting this same list with the combined hours per activity, and also sort it by that combined number. I tried combining the select with combining the sum of columns, but that gives me an error:
=query(E35:G232, "select G, sum(E), sum(F), sum(E:F) where ...
How can I further combine the grouped values to get the overall values per activity to get something like this, additionally sorted by highest combined?
Marketing | 14 | 5 | 19
Development | 5 | 12 | 17
Admin | 0 | 2 | 2
Best Answer
You can use a double query like: