Hi,
I am trying to use the custom question screen to calculate a score based on multiple columns. However, as soon as I try to combine multiple case expressions in a custom column I get an error:
Custom column:
case([Com Strategy] = "Yes", 1, 0) + case([Com Analytics] = "Yes", 1, 0)
Here is the error I get:
Value does not match schema: {:query {:expressions {:score (named [nil (named (named (not (some-matching-condition? a-clojure.lang.PersistentVector)) "Must be a valid instance of one of these clauses: :field-id, :field-literal, :joined-field, :fk->, :datetime-field, :expression, :binning-strategy") "x") (named (named (not (some-matching-condition? a-clojure.lang.PersistentVector)) "Must be a valid instance of one of these clauses: :field-id, :field-literal, :joined-field, :fk->, :datetime-field, :expression, :binning-strategy") "y")] "Must be a valid instance of one of these clauses: :+, :-, :/, :*, :coalesce, :length, :floor, :ceil, :round, :abs, :power, :sqrt, :exp, :log")}}}
Is my syntax incorrect?
Otherwise I can use custom SQL but as I am exploring data and would like to quickly change the fields returned (score stays the same) and explore the clusters I might get. Here is the valid SQL I use:
SELECT "source"."Score" AS "Score", Count(*)
FROM (
SELECT
"public"."survey"."org_name" AS "org_name",
CASE WHEN "public"."survey"."com_analytics" ilike '%yes%' THEN 3 ELSE 0 END +
CASE WHEN "public"."survey"."com_online_community" ilike '%yes%' THEN 3 ELSE 0 END +
CASE WHEN "public"."survey"."com_strategy" ilike '%yes%' THEN 5 ELSE 0 END
AS "Score"
FROM "public"."survey") "source"
GROUP BY "source"."Score"
ORDER BY "source"."Score" ASC
Thanks for any pointers!