Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
abhi1693r
Contributor II
Contributor II

Seaching the column for a value

Hi 

I have 5 columns A-E, with values 'X' or blank. (Snapshot attached)

Now I want to check if even one 'X' present in one column, add 10 for that column in a new expression.

I am using if(A='X',10,0) + if(B='X',10,0) ........

Somehow it is only working for one of the columns. Does this not search the entire column?

 

3 Replies
Anil_Babu_Samineni

How about this?

If(Index(Col1&'|'&Col2&'|'&Col3&'|'&Col4, 'X'), 10, 'No X Present') as New_Column

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anonymous
Not applicable

If this is on script, instead searching for 'X' try to not find this. Do a resident load

If(Index(Column1, 'X'), 1, 0) as _fgColumn1,
If(Index(Column2, 'X'), 1, 0) as _fgColumn2,
If(Index(Column3, 'X'), 1, 0) as _fgColumn3,
If(Index(Column4, 'X'), 1, 0) as _fgColumn4,
If(Index(Column5, 'X'), 1, 0) as _fgColumn5

Then make a total sum of each _fgColumnY, save on a variable.

Then if the varaible is 0, keep the value of column (ColumnY as newColumnY); if not, add 10 (Column+10 as newColumnY)

abhi1693r
Contributor II
Contributor II
Author

I guess this will only work if X is present as a character value in Excel, right?