Tableau没有从大查询中提取正确的数据

时间:2016-09-16 16:00:07

标签: google-bigquery tableau

对于上下文,我试图从github / zenhub数据中列出tableau中的“开放”问题,并最终将其排序为十大运行时间最长的问题。问题是我在大查询中的一些已关闭的问题在tableau中显示为open。 Big queryTableau。我的大查询在此示例中显示已关闭,但我的画面未显示它。下面是我在大查询中编写的SQL以获得结果。

`SELECT
 repo,
 ticket_number,
 title,
 assignee,
 state,
 pipeline,
 IF(state == "closed",IF(ABS(DATEDIFF(MAX(IF(assign_times IS NOT NULL,assign_times, created_at)), closed_at)) < 1,1,ABS(DATEDIFF(MAX(IF(assign_times IS NOT NULL, assign_times, created_at)), closed_at))),NULL) AS completion_time,
MAX(IF(assign_times IS NOT NULL, assign_times, created_at)) AS start_time,
MIN(created_at) AS created_at,
MAX(closed_at) as closed_at,
MAX(assign_times) AS assign_time,
MAX(points) AS points,
QUARTER(closed_at) AS quarter_closed,
YEAR(closed_at) AS year_closed
FROM
[icxmedia-servers:icx_metrics.issues_and_zenhub] AS historical,
(
SELECT
repository.name AS repo,
IF(issue.number IS NOT NULL, issue.number, pull_request.number) AS ticket_number,
FIRST(IF(issue.number IS NOT NULL, issue.title, pull_request.title)) AS title,
IF(issue.number IS NOT NUll, issue.assignee.login, pull_request.assignee.login) AS assignee,
pipeline.name as pipeline,
IF(MAX(IF(IF(issue.number IS NOT NULL, issue.state, pull_request.state) == "open",0,1)) == 1, "closed","open") AS state,
IF(issue.number IS NOT NULL, issue.created_at, pull_request.created_at) AS created_at,
MAX(IF(issue.number IS NOT NULL, issue.closed_at, pull_request.closed_at)) AS closed_at,
NULL AS assign_times,
MAX(estimate.value) AS points,
QUARTER(MAX(IF(issue.number IS NOT NULL, issue.closed_at, pull_request.closed_at))) AS quarter_closed,
YEAR(MAX(IF(issue.number IS NOT NULL, issue.closed_at, pull_request.closed_at))) AS year_closed
FROM
[icxmedia-servers:icx_metrics.gh_zh_data_production]
WHERE
issue.number IS NOT NULL
OR pull_request.number IS NOT NULL
GROUP BY
repo,
pipeline,
ticket_number,
created_at,
assignee) AS prod
GROUP BY
repo,
ticket_number,
title,
assignee,
pipeline,
state,
quarter_closed,
year_closed
 ORDER BY
ticket_number DESC`

1 个答案:

答案 0 :(得分:0)

Tableau和BigQuery之间的连接并不总是不断更新,即Tableau通常会下拉表本身的本地副本以进行可视化,而不是每次发生更改时都将查询发送到BQ。

也就是说,我认为您需要在Tableau“数据源”选项卡中更新数据集,因为BQ中的基础数据已更改。