繁体   English   中英

在数据工作室中找不到混合图表的运行总和

[英]Cannot find running sum of a blended chart in data studio

我正在尝试使用数据工作室创建一个用于跟踪大查询的图表。 相反,从 GCP 自动生成图表。 我正在尝试使用数据工作室中的工具创建图表。

SELECT t.timestamp, sum(t.introduced_violation) 
OVER( 
PARTITION BY t.introduced_user_id 
ORDER BY t.timestamp desc 
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) 
as cumulative_introduced_violation, 
sum(t.fixed_violation) 
OVER( 
PARTITION BY t.introduced_user_id 
ORDER BY t.timestamp desc 
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) 
as cumulative_fixed_violation, 
FROM (SELECT SUM(CASE 
WHEN is_fixed = 1 THEN 1 
ELSE 0 
END) AS fixed_violation, 
SUM(1) AS introduced_violation, 
timestamp, introduced_user_id 
FROM `project_id.violation.table_name` 
where introduced_user_id = 'username@company.com' 
and timestamp >=1622556834000 
and timestamp <=1631231999999 
group by timestamp, introduced_user_id 
order by timestamp desc) as t;

来自查询的预期 output:

在此处输入图像描述

首先,我尝试为内部查询创建图表(如下)。 我通过创建 2 个图表并将它们混合在一起来成功完成这一步。

SELECT SUM(CASE 
WHEN is_fixed = 1 THEN 1 
ELSE 0 
END) AS fixed_violation, 
SUM(1) AS introduced_violation, 
timestamp, introduced_user_id 
FROM `project_id.violation.table_name` 
where introduced_user_id = 'username@company.com' 
and timestamp >=1622556834000 
and timestamp <=1631231999999 
group by timestamp, introduced_user_id 
order by timestamp desc;

来自内部查询的预期 output:

在此处输入图像描述

与查询 output 一样,independent_violation 和 fixed_violation 值是 RunningSUM 值。

有没有办法在混合图表中找到引入的violation 和 fixed_violation 列的 RunningSUM 或其他方法来完成整个场景?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM