1
votes

I have this google sheet which contains 3 fields.

  1. Week number
  2. Weekly website page views for this year. It contains data until current week (19) this year.
  3. Week website pageviews for last year. It contains data for all the 52 weeks during previous year.

In data studio, I am using a time series chart to visualize this data.

enter image description here

Following are a couple of issues that I want to fix

  1. The chart is displaying data for all 52 weeks since last year's page views field contains data for 52 weeks. I only want the chart to display till the current week. That is, the chart x-axis should be until week 19 only.
  2. In case the chart is displayed in its current state will all 52 weeks, the blank cells for weeks in the current year are displayed as 0. (see the blue line coming down to zero and extending till week 52). How to avoid this and just end the line on week 19.

Please advise how to go about this.

Update: Based on the answer

=query(Data!A1:C, "where B is not null", 1)

I have stripped the data for the remaining weeks but the chart is still showing week till 52, though the sheet only contains data till week 19. The week field only contains week numbers from 1 to 19.

enter image description here

1

1 Answers

1
votes

To create a helper table that only includes rows where column B contains data, use Insert > New sheet and this formula in cell A1 of the new sheet:

=query(Data!A1:C, "where B is not null", 1)

Then use the helper table as your data source.