Knowledge Drop

Can you do a measure type: yesno?

  • 6 April 2021
  • 0 replies
  • 1199 views

Userlevel 5

Last tested: Jul 24, 2020
 

Yes you can!

You can create yesno measures the same way that you create yesno dimensions. See https://docs.looker.com/reference/field-reference/measure-type-reference#yesno.

When you filter on them, they go in the HAVING clause instead of the WHERE clause.

However, don't use them in filtered measures. You can only filter on dimensions in filtered measures.

Also, make sure they only reference other measures.

Tip: to create a yesno measure from a yesno dimension (in this example, it's "yes" if any dimension value is yes), we can use something like this:

measure : was_live

type: yesno

sql: sum(case when ${is_live} then 1 else 0 end) > 0 ;;

 

This content is subject to limited support.                

 


0 replies

Be the first to reply!

Reply