How do type: yesno fields work?

Knowledge Drop

Last tested: Aug 25, 2020
 

A yesno field will only evaluate a single thing. If we have a boolean coming in from the database, we can set the yesno field to something like this:

 

dimension: yesno_field

type: yesno

sql: ${TABLE}.boolean_database_column ;;

When that database column is true, we get a "Yes", and when it is no we will get a "No". However, we will also get a "No" if the row is null, since it does not meet the single evaluation of the boolean being true. This can become tricky if we are using this field in a filtered measures. That is, we may get cases where the row does not meet the criteria, but is also not a false value on the DB. A better solution if there are null values is a LookML CASE statement.

This content is subject to limited support.                

Version history
Last update:
‎06-14-2021 06:15 PM
Updated by: