View the original community article here
Author: Josh Lowin
Last tested: Feb 25, 2021
The Problem
If no value is selected when using a templated filter Looker will default to pass 1=1 in sql, so how can we evaluate this case to get a particular desired output?
A Solution
We can cast the liquid condition to a string and check if it evaluates to the string "1=1" and base the condition on that.
IF(CAST({% condition filter_name %} sql_or_lookml_reference {% endcondition %} AS STRING) = "1=1",no_condition_output,{% condition filter_name %} sql_or_lookml_reference {% endcondition %})
This content is subject to limited support.