2

I have data that looks like below:

date city state covid
1/1  NYC  NY    10
1/2  NYC  NY    15
1/3  NYC  NY    12
1/4  NYC  NY    11
 .    .    .    .
 .    .    .    .
 .    .    .    .
 .    .    .    .
1/1  LA   CA    10
1/2  LA   CA    15
1/3  LA   CA    12
1/4  LA   CA    11
 .    .    .    .
 .    .    .    .
 .    .    .    .

and I want to create, in google sheet, a stacked area chart where the x-axis is date, the y-axis is a number of the covid case, and the chart is grouped by city. Is it possible to create such a chart with minimum extra tables created?

1

You need one pivot chart that place the cities as the headers, for example, I added a column that combined the city and state, then used the following query to create the pivot chart that was used to create the chart in the example below.

=QUERY(A:E,"select A,sum(D) where D is not null group by A pivot E")

COVID Cases

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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