Custom filter on measure

I have created a parameter using allowed values and a certain range of percentages to select:

 parameter: param {
    type: unquoted
    allowed_value: {
      label: "0% <= x <5%"
      value: "zero_five"
    }
    allowed_value: {
      label: "10% <= x <15%"
      value: "ten_fifteen"
    }
    allowed_value: {
      label: "-15% <= x <20%"
      value: "fifteen_twenty"
    }
    allowed_value: {
      label: "x >= 20%"
      value: "over_twenty"
    }
    allowed_value: {
      label: "0% <= x <-5%"
      value: "minus_zero_five"
    }
    allowed_value: {
      label: "-10% <= x <-15%"
      value: "minus_ten_fifteen"
    }
    allowed_value: {
      label: "-15% - 20%"
      value: "minus_fifteen_twenty"
    }
    allowed_value: {
      label: "< -20%"
      value: "under_twenty"
    }
  }

I want to use this to interact with a measure calculates a % value. I’m not sure how to go about this. Any tips?

0 1 269
1 REPLY 1

I think you could use sql_always_having in the explore. If the parameter is used (has value) you apply the condition to the query but if not you leave it as 1=1 or anything else that always evaluates to true.

https://cloud.google.com/looker/docs/reference/param-explore-sql-always-having

You’ll have to use Liquid to insert the value

Top Labels in this Space
Top Solution Authors