跳转到内容

计算列示例

仪表板中的数据可以通过计算列进行扩充。每个数据集都包含一个计算列部分。计算列可以使用 PostgreSQL 风格的 SQL 编写和修改。

导航到数据集

要查看和编辑指标及计算表达式,请执行以下步骤:

  1. 登录 plaidcloud.com 并导航到仪表板
  2. 在 visualize.plaidcloud.com 中,导航到 Data > Datasets
  3. 搜索要查看或修改的数据集
  4. 将鼠标悬停在 Actions 下方的 edit 按钮上,修改数据集
COUNT(*)
min("MyColumnName")
max("MyColumnName")

Coalesce(例如可用于将 Null 转换为 0.0)

Section titled “Coalesce(例如可用于将 Null 转换为 0.0)”
coalesce("BaselineCost",0.0)
substring("PERIOD",6,2)
CAST("YEAR" AS integer)-1
concat("Biller Entity" , ' ', "Country_biller")
to_char("date_created", 'YYYY-mm-dd')
left("period",4)

除法,并用一个取巧的办法避免除以零(DIV/0)错误

sum("so_infull")/(count(*)+0.00001)
CASE WHEN "Field_A"= 'Foo' THEN max(coalesce("Value_A",0.0)) - max(coalesce("Value_B",0.0)) END
CASE WHEN "sol_otif_pod_missing" = 1 THEN
'POD is missing.'
ELSE
'POD exists.'
END
case when "Customer DC" = "origin_dc" or "order_reason_type" = 'Off Schedule' or "mot_type" = 'UPS' then
'Yes'
else
'No'
end
CASE WHEN "module_type" is NULL THEN '---' ELSE "module_type" END
CASE WHEN "NODE_TYPE" = 'External' THEN '3rd Party' ELSE "ENTITY_LOCATION_DESCRIPTION" END
concat("Class",' > ',"Product Family",' > ',"Meta Series")