Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
DMG
Contributor III
Contributor III

Counting where row data matches separate rows

I'm sure theres an easy way to do this and i'm just not spotting it.

I have various rows of data in my table, e.g.

Field_1 Field_2

A              DOG
A               CAT
A               FISH
B               DOG
B               CAT
C               CAT

I want the first field of the table to be deduplicated on Field_1 and then the next field to be a count of 1 where Field_2 is both CAT and DOG for the same instance of Field_1, so the result should look like

A   1

B   1

C   0

 

Hope that makes sense, thanks

1 Reply
chrismarlow
Specialist II
Specialist II

Hi,

Maybe;

Count({<Field_2={'CAT'}>}Field_1)*Count({<Field_2={'DOG'}>}Field_1)

20210604_1.png

Cheers,

Chris.