Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
gowtham2074
Contributor
Contributor

Filtering on Conditions.

Hello all,

I have data something like this

gowtham2074_0-1658154921706.png

and want to filter it in such a way that i need to get all records that contain either a or b in col1 and col2. Resulting in 

gowtham2074_1-1658154994995.png

can you let me know how do i add a filter to do the above.

 

Thank you,

Sai.

 

@sunny_talwar 

Labels (1)
4 Replies
edwin
Master II
Master II

if you can add  a measure, add in the set analysis:  {<col1={'a','b'}>+<col2={'a','b'}>}

which means include rows where col1 is ab or col2 is ab

edited - added closing brackets

sidhiq91
Specialist II
Specialist II

@gowtham2074  Please use the below Script in the back end. Also I have attached the output screen shot.

NoConcatenate
Temp:
Load * Inline [
Col1, Col2
a,b
c,c
d,b
];


NoConcatenate
Temp1:
Load *
Resident Temp
where Match(Col1,'a','b') or Match(Col2,'a','b');

Drop table Temp;

Exit Script;

If this resolves your issue, please like and accept it as a solution.

 

Venus1997
Contributor II
Contributor II

Test:
Load * inline
[
Col1,Col2
a,b
c,c
d,b
]
where Col1 = 'a' or Col1 = 'b' or Col2 = 'a' or Col2 = 'b'
;
Exit Script;

Mark_Little
Luminary
Luminary

Hi Similar,

To the above I would flag it in script if possible.

Something like

Load

Col1,

Col2,

IF( Col1 = 'a' or Col1 = 'b' or Col2 = 'a' or Col2 = 'b', 1,0) as Flag

From Table;