Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
sifatnabil
Specialist
Specialist

Count names from 2 fields in same table

Hi,

I have 2 fields in a table called "Buyer Broker" and "Seller Broker", and the same "broker" may populate in both fields, e.g.

Buyer Broker | Seller Broker

------------------|------------------

Andrew          Nathan

Andrew          Andrew

(null)               (null)

Nathan          Andrew

I would like to count the frequency of each broker's name from both fields and sum them, and then group by broker, e.g.

Andrew - 4

Nathan - 6

How could this be achieved? Thank you.

1 Solution

Accepted Solutions
Anonymous
Not applicable

4 Replies
Anonymous
Not applicable

PFA

er_mohit
Master II
Master II

see the attached file

maxgro
MVP
MVP

RESULT

In dim flag suppresss when value is null

Brokercount([Broker])
Andrew4
Nathan2



SCRIPT

Source:

load rowno() as id,

if (match(trim([Buyer Broker]), '(null)'), null(), [Buyer Broker]) as [Buyer Broker],

if (match(trim([Seller Broker]), '(null)'), null(), [Seller Broker]) as [Seller Broker]

;

load * inline [

Buyer Broker , Seller Broker

Andrew    ,      Nathan

Andrew    ,      Andrew

(null),           (null)

Nathan    ,      Andrew

];

Tab:

load id, [Buyer Broker] as Broker, 'Buyer' as BrokerType

Resident Source;

Concatenate (Tab)

load id, [Seller Broker] as Broker, 'Seller' as BrokerType

Resident Source;

sifatnabil
Specialist
Specialist
Author

NoConcatenate.PNG.png

Hi Nitin and Mohit,

Your solutions are similar but I have a question:

Why is there a noConcatenate statement between T1 and T2? As there are no common field names, is it necessary to use noConcatenate there? See attached image.