Knowledge Drop

How do type: yesno fields work?

  • 15 June 2021
  • 0 replies
  • 1279 views

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.                

 

 

 


0 replies

Be the first to reply!

Reply