1

I'm trying to figure out how to chart this in Google Sheets. Each segment of the pie chart should be the sum of each different "Type", e.g. there should only be one pie segment per type.

I tried clicking "Aggregate" but it made the chart go blank.

Data and current incorrect chart Chart settings

1

1 Answer 1

3

You can aggregate the data by putting this formula in a cell in a free area of the spreadsheet:

=query(C1:D, "select C, sum(D) where C is not null group by C", 1)

Then select the whole result table and choose Insert > Chart.

If the result table has multiple occurrences of "Entertainment", you probably have differences in the spacing of the values in column C, and will need to use this longer formula instead:

=arrayformula( 
  query( 
    { trim(C1:C), D1:D }, 
    "select Col1, sum(Col2) where Col1 is not null group by Col1", 
    1 
  ) 
)
1
  • This worked great, only problem was all the results were -negative which made the chart empty, so i added a multiply of -1 to make them all positive. :)
    – Issung
    Jan 9, 2023 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.