how to replace blanks with values from another column

Hi All,

 

I am trying to populate blank cell with a value from another column, i.e. 

 

if 'country' is blank then populate with a value from 'country_1'

 

I tried the below, but it doesn't seem to work. 

 

CASE

WHEN LENGTH(`Country`)=0
THEN `Country_1`

END

 

Please help!

 

Thanks

Max

Comments

  • ST_Superman
    ST_Superman Domo Employee
    IFNULL (`country`, `country_1`)
  • rado98
    rado98 Contributor

    The previously proposed formula will fix your issue, however if you need to use case statement (for another reason) the following should work I think

     

    CASE

    WHEN TRIM(`Country`) = ''
    THEN `Country_1`

    ELSE `Country`

    END

  • rahul93
    rahul93 Contributor

    might want to use a case statement for blanks and nulls.

     

     

    Case when trim(`country`) = '' or `country` is null then `country` else `country` end