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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Counting different columns in the same row?

Hi Qlik Gurus,

I have a question and am not sure how to solve.

I have two columns of countries (creator country and Receiver country).

for each country, count the creator country and receiver country in the same line.

For example, AU appears 3 times as a Creator and 1 time as a Receiver.

Any ideas how to go about resolving this?

thanks

this is the raw data:

IDCreatorReceiverRef
I0001AUTHAU-TH
I0011AUUKAU-UK
I0017AUMYAU-MY
I0002MYAUMY-AU
I0004MYUKMY-UK
I0008MYUKMY-UK
I0021MYUSMY-US
I0003SGUKSG-UK
I0009THUSTH-US
I0010THMYTH-MY
I0015THUSTH-US
I0016THUKTH-UK
I0022THUKTH-UK
I0005UKUSUK-US
I0007UKTHUK-TH
I0012UKUSUK-US
I0013UKMYUK-MY
I0018UKTHUK-TH
I0019UKMYUK-MY
I0023UKMYUK-MY
I0006USMYUS-MY
I0014USUKUS-UK
I0020USUKUS-UK
I0024USTHUS-TH

the result i want to display is:

  

CreatorReceiver
AU31
MY46
SG10
TH54
UK78
US45
1 Solution

Accepted Solutions
sunny_talwar

Check out the attached

Capture.PNG

Script:

Leads:

LOAD ID,

     Creator,

     Receiver,

     Ref

FROM

[https://community.qlik.com/thread/212579]

(html, codepage is 1252, embedded labels, table is @1);

LinkTable:

LOAD ID,

  Creator as Country,

  'Creator' as Flag

Resident Leads;

Concatenate (LinkTable)

LOAD ID,

  Receiver as Country,

  'Receiver' as Flag

Resident Leads;

Data Model:

Capture.PNG

View solution in original post

4 Replies
sunny_talwar

Check out the attached

Capture.PNG

Script:

Leads:

LOAD ID,

     Creator,

     Receiver,

     Ref

FROM

[https://community.qlik.com/thread/212579]

(html, codepage is 1252, embedded labels, table is @1);

LinkTable:

LOAD ID,

  Creator as Country,

  'Creator' as Flag

Resident Leads;

Concatenate (LinkTable)

LOAD ID,

  Receiver as Country,

  'Receiver' as Flag

Resident Leads;

Data Model:

Capture.PNG

swuehl
MVP
MVP

You could load your table like

CROSSTABLE (Actor, Country)

LOAD ID, Creator, Receiver

FROM ...;

Then create a pivot table chart with dimensions Country and Actor and expression

=Count(DISTINCT ID)

swuehl
MVP
MVP

Anonymous
Not applicable
Author

thank you Sunny! you are a star!