Google Data Studio:如何使用自定义 Big Query 查询创建时间序列图表

Google Data Studio: how to create time series chart with custom Big Query query

我有一个添加了时间序列的 Data Studio 报告。数据源来自使用 Big Query 连接器的自定义查询:

select user_dim.app_info.app_version, count(1) as count 
from [my_app_domain_ANDROID.app_events_20160929] 
group by 1

根据位于以下位置的 Data Studio 文档:https://support.google.com/360suite/datastudio/answer/6370296?hl=en

BigQuery supports querying across multiple tables, where each table has a single day of data. The tables have the format of YYYYMMDD. When Data Studio encounters a table that has the format of YYYYMMDD, the table will be marked as a multi-day table and only the name prefix_YYYYMMDD will be displayed in the table select.

When a chart is created to visualize this table, Data Studio will automatically create a default date range of the last 28 days, and properly query the last 28 tables. You can configure this setting by editing the report, selecting the chart, then adjust the Date Range properties in the chart's

但是,在“时间序列属性数据”选项卡中,select 没有有效的“时间维度”。根据文档,我不需要 select 时间维度。它应该自动查询正确的table。

我还有什么不明白的?

问题中的查询有2个问题:

  1. 要获取时间序列,您需要向自定义查询添加一个基于时间的列。

例如:

SELECT created_at, COUNT(*) c
FROM [githubarchive:day.20160930]
WHERE type='WatchEvent'
GROUP BY 1
  1. Data Studio 不会使用自定义查询进行 28 天扩展。要获得文档中的扩展,您需要指向一个实际的 table(Data Studio 将找出前缀和日期扩展)。

我在以下位置留下了一个工作示例: