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: 
Anonymous
Not applicable

How to count matching values in 3 different fields

Hi,

How do i create an expression where i can calculate how many of the same value it is in the different fields?

  

Campaign1Campaign2Campaign3
B
CAD
ACB
DA
BA

Expecting result:

A=5

B=3

C=2

D=2

Thanks in advance,

Fredrik

Labels (1)
4 Replies
Nagaraju_KCS
Specialist III
Specialist III

Try this.. !

Test:

LOAD * Inline [

Campaign1,Campaign2,Campaign3

A,B

C,A,D

A,C,B

D,A

B,A

];

Test1:

NoConcatenate

Load  Campaign3 as key Resident Test;

Load  Campaign2 as key Resident Test;

Load  Campaign1 as key Resident Test;

DROP Table Test;

I feel this is not correct way, but one option.

Digvijay_Singh
MVP
MVP

Check this  out-

sunny_talwar
MVP
MVP

Another option is to use CrossTable load


Temp:

CrossTable (Campaign, Value)

LOAD 1 as 1,

*;

LOAD * INLINE [

    Campaign1, Campaign2, Campaign3

    A, B

    C, A, D

    A, C, B

    D, A

    B, A

];


FinalTable:

LOAD Campaign,

Value

Resident Temp

Where Len(Trim(Value)) > 0;


DROP Table Temp;

Anonymous
Not applicable
Author

Hi you,

Thanks for the answer's!

Two things,

I'm using Qlik Sense, how to open the .qvw files?

I having my data in an Excel sheet and the tab is called Data. The example I add was only some example how it looks like but in my file I have more then 1000 row with data. So not only the row I add in my question.