Example Calculated Columns
Description
Section titled “Description”Data in dashboards can be augmented with calculated columns. Each dataset will contain a section for calculated columns. Calculated columns can be written and modified with PostgreSQL-flavored SQL.
Navigating to a dataset
In order to view and edit metrics and calculated expressions, perform the following steps:
- Sign into plaidcloud.com and navigate to dashboards
- From within visualize.plaidcloud.com, navigate to Data > Datasets
- Search for a dataset to view or modify
- Modify the dataset by hovering over the
editbutton beneathActions
Examples
Section titled “Examples”COUNT(*)min("MyColumnName")max("MyColumnName")Coalesce (useful for Converting Nulls to 0.0, for Instance)
Section titled “Coalesce (useful for Converting Nulls to 0.0, for Instance)”coalesce("BaselineCost",0.0)Substring
Section titled “Substring”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)Divide
Section titled “Divide”divide, with a hack for avoiding DIV/0 errors
sum("so_infull")/(count(*)+0.00001)Conditional Statement
Section titled “Conditional Statement”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" ENDConcatenate
Section titled “Concatenate”concat("Class",' > ',"Product Family",' > ',"Meta Series")