Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
khaycock
Creator
Creator

IF statement to use populated field

I have two reports of data but I want to generate a statement that will only show data from a field if it is populated, and if it isn't populated show the other field.

I know this is a generic IF statement but can't figure out how to word the IF statement for a populated field rather than a specific selection.

Something like:

IF([Mike Risk Factor]=(no idea what to put here), [Mike Risk Factor], [Risk Factor])

1 Solution

Accepted Solutions
giovanneb
Creator II
Creator II

Try this,

IF(LEN(TRIM([Mike Risk Factor]))>0, [Mike Risk Factor], [Risk Factor])

View solution in original post

5 Replies
giovanneb
Creator II
Creator II

Try this,

IF(LEN(TRIM([Mike Risk Factor]))>0, [Mike Risk Factor], [Risk Factor])

atoz1158
Creator II
Creator II

You may also want to cater for the case of the field being NULL by using

isnull([Mike Risk Factor])

balabhaskarqlik

Try this:

IF([Mike Risk Factor]=' ', [Mike Risk Factor], [Risk Factor]) as Factor

atoz1158
Creator II
Creator II

Try this covering both an empty field and a null field

IF(TRIM([Mike Risk Factor])='' OR ISNULL([Mike Risk Factor]), [Risk Factor], [Mike Risk Factor])

giovanneb
Creator II
Creator II

My recommendation would already treat the field by removing the nulls with TRIM and it would check if the field size is greater than 0 with LEN thus perfectly servicing the request.

Reguards