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 III
Creator III

Nested IF in Load statement

Hi Experts - I have 2 columns A & B. I need to add an calculated field (Nested IF) in the load statement itself..

If value in column A is blank... i need the output as "No Value" else it has to go to the 2nd condition and check ... If value in Column B is Inactive.. it should give us inactive .. for values other than inactive.. it should give as Active.

Kindly find the attached excel..

I need this to be in the load statement itself.

1 Solution

Accepted Solutions
Highlighted

Try this

Table:

LOAD RowNo() as RowNum,

A,

    B,

    If(Len(Trim(A)) = 0, 'No Value', If(B = 'Inactive', 'Inactive', 'Active')) as Value

FROM

[..\..\Downloads\load.xlsx]

(ooxml, embedded labels, table is Sheet1);

Capture.PNG

View solution in original post

7 Replies
Highlighted

Try this

Table:

LOAD RowNo() as RowNum,

A,

    B,

    If(Len(Trim(A)) = 0, 'No Value', If(B = 'Inactive', 'Inactive', 'Active')) as Value

FROM

[..\..\Downloads\load.xlsx]

(ooxml, embedded labels, table is Sheet1);

Capture.PNG

View solution in original post

Highlighted
Contributor III
Contributor III

HI Bharani,

You can use below expression

if(IsNull(A), 'No Value', if(B='Inactive', 'Inactive','Active'))

Thanks and Regards

Ankur

Highlighted
Creator III
Creator III

Hey Sunny --Thank u very much..Got it Perfect.. Actually i tried like below..


  If(A = ' ', 'No Value', If(B = 'Inactive', 'Inactive', 'Active')) as Value


I was not getting it.. Can u plz tell me why? so that i can understand better..


Regards

Bharani

Highlighted
Contributor III
Contributor III

Hi Bharani,

In the below expression you are basically searching for space (' ') in column A instead of Null values .

If(A = ' ', 'No Value', If(B = 'Inactive', 'Inactive', 'Active')) as Value

Null values, space (' '), 0 are different, you need to handle it separately.


Thanks and Regards

Ankur

Highlighted

Checking for space is not right because you mentioned that it is null... so Len(Trim(A)) checks if the the Len of Trimmed A is 0 or not... When it is 0, it means A is either null or made up of blank spaces

Highlighted
Creator III
Creator III

Thank you Abhi!! That was a clear Explaination!!

Highlighted
Creator III
Creator III

Thank you Sunny!! Got it!