Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Set analysis string comparison

Hello All,

I am trying to write a set analysis expression to make a count of Title in a particular category

Title ID

Title

Categories

Category_1

Category_2

Category_3

1

ABC

C1|C2

C1

C2

 

2

DEF

C2|C3

C2

C3

 

3

GHI

C1|C3|C2

C1

C3

C2

4

JKL

C3|C1

C3

C1

 

If Count of titles in C1 should return 3 rows, i.e. ABC, GHI & JKL. 

I have used the hard-coded expression  Count({1<Category= {"*C1*"}>} Title). This is returning the expected result. I want to replace this with filed Category_1.

Can anyone please help.

Thanks in advance 

 

5 Replies
Anil_Babu_Samineni

PFA, If this helps

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Thanks for your response. But I need C1 count as 3.  

Title ID

Title

Categories

1

ABC

C1|C2

3

GHI

C1|C3|C2

4

JKL

C3|C1

These 3 rows needs to be considered

PradeepReddy
Specialist II
Specialist II

try something like this...

Input:
Load *,
If(Wildmatch(Categories,'*C1*')>0,'Y','N') as Category1,
If(Wildmatch(Categories,'*C2*')>0,'Y','N') as Category2,
If(Wildmatch(Categories,'*C3*')>0,'Y','N') as Category3;
Load * Inline
[
TitleID,Title,Categories
1,ABC,C1|C2
3,GHI,C1|C3|C2
4,JKL,C3|C1
];

Expression..
C1: Count({<Category1={'Y'}>}TitleID)
C2: Count({<Category2={'Y'}>}TitleID)
C3: Count({<Category3={'Y'}>}TitleID)
PradeepReddy
Specialist II
Specialist II

this solution suits, when you know the total categories in advance..
sunny_talwar




@Anonymous wrote:

 

I have used the hard-coded expression  Count({1<Category= {"*C1*"}>} Title). This is returning the expected result. I want to replace this with filed Category_1. 


What do you mean when you say that you want to replace this with filed Category_1? You want to replace your set analysis from Category field to Category_1 field? Why? Can you elaborate on what are you exactly trying to do?