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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Qlik_Learner11
Contributor II
Contributor II

Search for a value from multiple rows and create a new column whether the value exists

Hi,

I need to search for a value in multiple rows and if the value exists in any of the rows, I need to flag it. Below table has columns case# and remark. I need to search value "x" in remark, if it exists in any of the rows for a case#, I need to flag it. The value "x" could be any of the rows for a case#. 

Sample: 

Qlik_Learner11_0-1696107438338.png

Output required:

Qlik_Learner11_1-1696107551535.png

I do NOT need this. Using If statement gives me below output.

case# remark_x
1 N
1 N
1 Y
1 N
2 N
2 N
2 N
3 Y
3 N

 

Thank you!

Labels (1)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like below

If you have only case# as dim, then exp is

if(SubStringCount(Concat(DISTINCT remark, ','), 'x') > 0, 'Y', 'N')

suppose, if you have both case#, remark as dim, then exp is

if(SubStringCount(Concat(DISTINCT TOTAL<case#> remark, ','), 'x') > 0, 'Y', 'N')

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

Hi

Try like below

If you have only case# as dim, then exp is

if(SubStringCount(Concat(DISTINCT remark, ','), 'x') > 0, 'Y', 'N')

suppose, if you have both case#, remark as dim, then exp is

if(SubStringCount(Concat(DISTINCT TOTAL<case#> remark, ','), 'x') > 0, 'Y', 'N')

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Qlik_Learner11
Contributor II
Contributor II
Author

Thanks so much!