Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Coolavin
Partner - Contributor III
Partner - Contributor III

Having trouble getting duplicate results to show up.

Hello,

I have two fields, Email and ExamCode.

I need to find the Emails that have duplicate ExamCodes

For example:

EmailExamCode
email1@test.com110C
email1@test.com116C
email1@test.com116C
email1@test.com116C
email1@test.com110C
email1@test.com316C
email2@test.com110C
email2@test.com117C
email2@test.com118C
email2@test.com316C
email3@test.com116C
email3@test.com117C
email3@test.com119C
email3@test.com316C
email3@test.com316C
email4@test.com

110C

 

I would need something where the results would be something like this:

EmailsDuplicate ExamCodesCount
email1@test.com116C3
email1@test.com110C2
email3@test.com316C2

It excludes email2 and 4 because they don't have duplicates. 

 

I tried something like this:
Count(TOTAL<Email> ExamCode) >= 2

I also tried to use a substingcount like the one below:

SubStringCount(Concat ( TOTAL <Email> SubField(Email, ' ',1)&SubField(ExamCode, ' ',1)&' '), SubField(Email, ' ',1)&SubField(ExamCode, ' ',1)&' ') >= 2

But they end up including ones that just have single ExamCodes. I am not sure what I am doing wrong. 

5 Replies
lironbaram
Partner - Master III
Partner - Master III

Hi, 
It should be quite straightforward. 
Build a table with Email and Exam Code as dimensions and this expression:

 

if(count(Email)>1,Count(Email))

 

Coolavin
Partner - Contributor III
Partner - Contributor III
Author

But that only gives me email counts. not examcode counts.

stevejoyce
Specialist II
Specialist II

Try this.  I am counting "1" to just get number of records.  You could use a key of that table if you want to count different but this should suffice:

If(Count(Total <Email, ExamCode> 1) > 1, Count(Total <Email, ExamCode> 1))

Coolavin
Partner - Contributor III
Partner - Contributor III
Author

If(Count(Total <Email, ExamCode> 1) > 1, Count(Total <Email, ExamCode> 1))

This seems to be counting all ExamCode per email where emails have more than one ExamCode. 

But it needs to find only emails that have duplicate ExamCodes not just more than one unique ExamCodes.

 

stevejoyce
Specialist II
Specialist II

If Email & ExamCode are your dimensions (which is what your screenshot had), and that is your expression, it is counting the number of records for each Email + ExamCode ("Total <Email, ExamCode> ").

stevejoyce_0-1629991542304.png