0
votes

I need help to combine the following commands to use a single Google Query command to obtain the Totals for Rows and Columns without relying on Pivot Tables:

QUERY 1 =QUERY(TESTDATA!A1:C16, "SELECT A, SUM(C) GROUP BY A PIVOT B",1)

QUERY 2 =QUERY(TESTDATA!A1:C16, "Select SUM (C) GROUP BY A label SUM (C) 'NAME ROW TOTALS'")

QUERY 3 ={transpose(Query(TESTDATA!A1:C16, "Select SUM (C) GROUP BY B label SUM (C) 'MONTH COLUMN TOTALS'"))}

https://docs.google.com/spreadsheets/d/15i1E8AZHORRmPlu1VQqFRN1_7-aUyAz-hlYMOUtIlY4/edit?usp=sharing

I would like to return the following result:

enter image description here

Thank you very much JA

1

1 Answers

0
votes

use:

={{QUERY(TESTDATA!A1:C, "select A,sum(C) group by A pivot B", 1),
   QUERY(TESTDATA!A1:C, "select sum(C) group by A label sum(C) 'NAME TOTAL'")}; TRANSPOSE(
   QUERY(TESTDATA!A1:C, "select sum(C) group by B label sum(C) 'MONTH COLUMN TOTALS'"))}

enter image description here