小编Nik*_*RLA的帖子

从 Bigquery 的时间戳中提取月份和年份

我想从时间戳列(YYYYMMDD HHMMSS)中提取月份和年份,如果月份是 1,它应该创建一个名为“January”的列,月份是 2,它应该创建一个名为“February”的列。

这是我尝试过但没有运气的查询。

SELECT
  SUM(case when extract(month() from timestamp) = 1 and extract(year() from timestamp) = '2018' then total else 0 end ) as January ,
  SUM(case when extract(month() from timestamp) = 2 and extract(year() from timestamp) = '2018' then total else 0 end ) as February, and so on until December..

FROM x;
Run Code Online (Sandbox Code Playgroud)

google-bigquery

9
推荐指数
4
解决办法
3万
查看次数

Google Data Studio 中的 COUNTIFS 函数

我有 2 列称为大洲和完成度,我想根据以下数据计算每个大洲的完成度百分比。这是在 excel 中使用 COUNTIFS() 函数定义的

我们可以在数据工作室中实现这个吗??

完成百分比公式是“关闭”状态的总数/状态值的总数 状态值是“打开”、“进行中”、“服务完成”、“关闭”

continent          completion %         

------------     -------------------       

Asia                  97%(used countifs function to calculate percentage in excel)
Europe                89%              
North America         93%      
Run Code Online (Sandbox Code Playgroud)

google-data-studio

4
推荐指数
1
解决办法
3万
查看次数