I'm trying to cope with blanks and a total row in google sheets. This is my ridiculous solution. I'm sure, someone has a much better solution
={query({query (query(vd!A:G,"select C,sum(G) where F = 'fm' or F = 'fma' group by C pivot F order by C"),"select Col1"),arrayformula(query (N(query(vd!A:G,"select C,sum(G) where F = 'fm' or F = 'fma' group by C pivot F order by C")),"select Col2, Col3"))},"select Col1,Col2,Col3, Col3-Col2 where Col2-Col3 > 50000 or Col2-Col3 < -50000 label Col1 'Program', Col2 'Forecast', Col3 'Actuals', Col3-Col2 'Variance'");{"Total",index(query({query (query(vd!A:G,"select C,sum(G) where F = 'fm' or F = 'fma' group by C pivot F order by C"),"select Col1"),arrayformula(query (N(query(vd!A:G,"select C,sum(G) where F = 'fm' or F = 'fma' group by C pivot F order by C")),"select Col2, Col3"))},"select sum(Col2),sum(Col3), sum(Col3)-sum(Col2) where Col2-Col3 > 50000 or Col2-Col3 < -50000"),2)}}
I made a view of the sheet this is on for easier handling. Is there an easy way to anonoymize data?
https://docs.google.com/spreadsheets/d/1YA7xgOtOXKhtOos6acaS40BMxBcAE8g9VMkdUaBGrMg/edit?usp=sharing
