Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qlik get distinct count from multiple fields

Tags:

I've been scouring the net for over an hour and cannot find what I need.

I have two columns that contain a persons name; Contact and Created By. Both are in identical format.

Basically I need to count the distinct values of BOTH these columns combined. e.g. The name can be in each column of data multiple times but I only want the name counted once.

I tried using the below but it is returning a number higher than the actual distinct values between both columns.

=Sum(Aggr(Count(Distinct [Created By]),[Contact])) 

also tried this and am the same number is returned as the above.

=Count(Distinct [Contact] & [Created By])

Thanks in advance!

like image 722
Mark Avatar asked Mar 07 '17 20:03

Mark


1 Answers

I think you can try something like this:

count(distinct Contact) + count({$<[Created By]-=p(Contact)>} distinct [Created By])

Basically, it adds the count of uniques from Contact to the count of uniques from Created By where Created By isn't one of the names in Contact.

like image 114
bdiamante Avatar answered Sep 25 '22 11:09

bdiamante