Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
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
Highlighted
Creator II
Creator II

Try this,

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

View solution in original post

Highlighted
Creator II
Creator II

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

isnull([Mike Risk Factor])

Highlighted

Try this:

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

Highlighted
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])

Highlighted
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