Knowledge Drop

Can you use the field value as the else in a CASE?

  • 6 April 2021
  • 0 replies

Userlevel 5

Last tested: Sep 7, 2019

No, not in the Looker Case-When statement!

However, you can accomplish this in the sql parameter with a CASE WHEN statement.


dimension: country_bucketed {

type: string

sql: CASE WHEN ${country} = 'United States'

THEN 'United States of America'

ELSE ${country}

END;; }


Note: If you leave out the "else" condition with a Looker case parameter, Looker will bucket everything else as a null


This content is subject to limited support.                


0 replies

Be the first to reply!