2016-09-16 327 views
0

對於上下文,我試圖從github/zenhub數據中列出tableau中的「open」問題列表,並最終將它排序前十個最長的運行問題。問題在於,大查詢中的一些已關閉問題在tableau中顯示爲開放。 Big queryTableau。我的重要查詢在本例中顯示爲關閉,但我的畫面沒有顯示它。下面是我在大查詢中編寫的SQL來獲取結果。Tableau無法從大查詢中提取正確的數據

`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` 

回答

0

的Tableau和BigQuery的之間的連接並不總是不斷更新,即會的Tableau通常下拉表本身的本地副本可視化,而不是發送查詢BQ每次有改變的時候。

也就是說,我認爲您需要更新Tableau「數據源」選項卡中的數據集,因爲BQ中的基礎數據已更改。