Reputation: 4884
I have date, name, and paid amount columns. I want to return each unique date in a row and for each unique date return all the names and summed paid amounts.
=query(A:X,"SELECT V, SUM(X) WHERE A= date '2020-08-11' GROUP BY V")
this is what I have right now. This is returning the names and summed paid amounts for this date but I there are many other dates and in this case I would have to manually edit the date.
V = names
X = paid amount
A = dates
Data Structure I am looking for
Date
2020-08-20 2020-08-21
Courier Name Summed Paid Amount for the 2020-08-20 Courier Name Summed Paid Amount for the 2020-08-21
Courier Name Summed Paid Amount for the 2020-08-20 Courier Name Summed Paid Amount for the 2020-08-21
Courier Name Summed Paid Amount for the 2020-08-20 Courier Name Summed Paid Amount for the 2020-08-21
Courier Name Summed Paid Amount for the 2020-08-20 Courier Name Summed Paid Amount for the 2020-08-21
Link for what I have right now:
https://docs.google.com/spreadsheets/d/1JR20wsd9bAsQLEtRpqbPNOoDionA6sOmCVUibGPrOKA/edit?usp=sharing
Upvotes: 0
Views: 539
Reputation: 478
This is the pivot query I added to the sheet. I think this is what you're trying to accomplish.
=query(A1:C19,"SELECT B, SUM(C) WHERE A is not null GROUP BY B PIVOT A label SUM(C)''")
Upvotes: 1