Hi there.
Well, I can't begin to try understanding what is going on, or the purpose of it all, however it seems like there's a lot of calculations, searched cases and stuff in there... Very briefly, I don't think that you can change the group by in any easy way... (At least not without further knowledge of the underlying tables and what the query should return)
A common way, though, of 'reducing' columns, is to nest queries as virtual tables. If the query above is to be seen as an 'intermediate table', or 'temp table/result', you could use it that way. Something along these lines:
SELECT