In this answer (with all executable simplified and documented sample code + helpful comments)
I did a kind of a trick there to calculate the last two rows of the following table:
DESCR SUM
---------------------------------- ----------
money available in 2013 33233235.3
money spent in 2013 4253235.3
money bound to contracts in 2013 34333500
money spent 2013 in % of available 12
money bound 2013 in % of available 103
Does anybody know of a better (performance, amount of code, understandability) way to do these kind of operations?
(Than to use the applied "provide unioned null row, fill with case and product()-over() on n+1 aggregation level-trick", let's call it punurofiwicapoonalt-trick (naah ... still to complicated) ... sounds like - yeah - let's call it just porno-trick ;O) (... okay ... alias capoon-trick if you do not like it))
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…