Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.


If statement formula

Hi Guys.

I need help with an if statement.

I have two columns in a table.

Column A and Column B

I want to write statement to say

When Column B is NULL to Column A then give the value Unknown

So far i have only wrote an if statement for Column B but it is still not working

if(len(trim(ColumnB)) = 0, 'Unknown', ColumnB) as ColumnB,



4 Replies
Honored Contributor III

Re: If statement formula

try this

if(isnull(ColumnB),'Unknown', ColumnA) as ColumnB,

Re: If statement formula

Normally your approach should work but maybe there are any other not visible chars within ColumnB. To check on them you could copy these values into an editor like notepad ++ or checking them within Qlik with functions like len(), mid() and ord() or you could also try something like: keepchar(ColumnB, 'a..zA..Z0..9') to clean the fieldvalues before apply any checking.

- Marcus


Re: If statement formula

It says Column A is not found

New Contributor III

Re: If statement formula

I don't understand what you are trying to do.. Where is column A in your example? Can you add a example file?