View the original community article here
Last tested: March 2021
Looker’s “yesno” dimensions return boolean values (TRUE or FALSE) rather than a string “yes” or “no”. For this reason, when SQL is involved, you don’t need to write “field == yes”, you can simply write “field”, as this will return TRUE or FALSE by itself. Here are specific examples depending on where you’d like to reference it:
SQL:
You can treat it as a boolean.
sql: CASE WHEN ${field} THEN ...
Filtered Measure:
measure: first_purchase_count {
type: count
filters:[is_first_purchase:"Yes"]
Liquid HTML
{% if value == 'Yes' %}
will do it.
Note: it is case sensitive.
Templated filter:
We put a boolean in between the condition, like:
derived_table: {
sql:SELECT murder FROM public.ra
where {% condition filter %} murder=10 {% endcondition %} ;;
}
dimension: filter {
type: yesno
sql: ${TABLE}.murder=10;;
}
cite docs for type yesno , docs for filtered measures and docs for liquid variables
This content is subject to limited support.