Question

Unexpected ELSE in parameter

  • 24 January 2022
  • 0 replies
  • 16 views

I have the following parameter code block:

 


  set: absolute {
    fields: [
      10th_percentile,
      25th_percentile,
      50th_percentile,
      75th_percentile,
      90th_percentile,
      mean
    ]
  }

  set: normalized {
    fields: [
      n_10th_percentile,
      n_25th_percentile,
      n_50th_percentile,
      n_75th_percentile,
      n_90th_percentile,
      n_mean
    ]
  }

### Create a parameter which allows you to select a metric type from the field sets above ###

  parameter: metric_type {
    type: unquoted
    allowed_value: {
      label: "Normalized"
      value: "normalized"
    }

    allowed_value: {
      label: "Absolute"
      value: "absolute"
    }
  }

  dimension: dynamic_selection {
    type: number
    label_from_parameter: metric_type
    sql: case when {% condition metric_type %} 'normalized' {% endcondition %} then ${TABLE}.normalized*
              else ${TABLE}.absolute* end;;
  }
  ### }
 

But I get the error: 

 

Query execution failed: - Syntax error: Unexpected keyword ELSE at [13:15]

WITH TABLE AS (SELECT    (TIMESTAMP(FIELD )) AS FIELD,    FIELD  AS FIELD,    COALESCE(SUM(FIELD ), 0) AS FIELD,    COALESCE(SUM(FIELD  /  FIELD   ), 0) AS FIELDFROM `table`     AS tableGROUP BY    1,    2)SELECT    case when ('normalized' = 'normalized') then table.normalized*              else table.absolute* end AS fieldFROM `table`     AS fact_ab_test_dailyLEFT JOIN …………GROUP BY    1ORDER BY    1LIMIT 2

Filters (1)

 Custom Filter

 

Thanks!


This topic has been closed for comments