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

Knowledge Drop

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.

Example:

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.                

Version history
Last update:
‎04-05-2021 03:15 PM
Updated by: