计算列示例
仪表板中的数据可以通过计算列进行扩充。每个数据集都包含一个计算列部分。计算列可以使用 PostgreSQL 风格的 SQL 编写和修改。
导航到数据集
要查看和编辑指标及计算表达式,请执行以下步骤:
- 登录 plaidcloud.com 并导航到仪表板
- 在 visualize.plaidcloud.com 中,导航到 Data > Datasets
- 搜索要查看或修改的数据集
- 将鼠标悬停在
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)-1Concat 函数
Section titled “Concat 函数”concat("Biller Entity" , ' ', "Country_biller")To_char
Section titled “To_char”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)) ENDCASE WHEN "sol_otif_pod_missing" = 1 THEN'POD is missing.'ELSE'POD exists.'ENDcase when "Customer DC" = "origin_dc" or "order_reason_type" = 'Off Schedule' or "mot_type" = 'UPS' then 'Yes'else 'No'endCASE WHEN "module_type" is NULL THEN '---' ELSE "module_type" ENDCASE WHEN "NODE_TYPE" = 'External' THEN '3rd Party' ELSE "ENTITY_LOCATION_DESCRIPTION" ENDconcat("Class",' > ',"Product Family",' > ',"Meta Series")