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

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

count if value in two columns are the same

Hi,

I have a hierarchy data set and there are cases where parent level and child level are sharing the same value.

There are two things that I want to do with that.

1. count the number of rows that share the same value for PARENT  and CHILD

2. actually filtering for those rows so that I can bring them in to excel file.

for the first question I was thinking about writing something like

count( distinct if ( PARENT = CHILD), PARENT)

but it does not seem to work.

and for the second one I have no clue at the moment.

Please help!

Thank you!

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

Maybe

Sum(

     If( PARENT = CHILD, 1, 0 )

)

View solution in original post

3 Replies
Clever_Anjos
Employee
Employee

Maybe

Sum(

     If( PARENT = CHILD, 1, 0 )

)

ankali1990
Contributor III
Contributor III

Hello,

you could create flags in the script and after that to sum them in the layout. I prefer to do that instead of sum(if()).

Regards

abhi1693r
Contributor II
Contributor II

Hi Stephan,
I had a similar issue. So I have two columns, PART AND CUBES, with one to many relationship.(one PART can have many CUBES or a PART can have no CUBE).
Scenario: If I select 3 PARTS which have 2 CUBES, wherein 2 PARTS have 2 CUBES and 1 PART has no CUBE. I want a count of all the CUBES plus any PART which has no CUBES.

PARTCUBES
SW10011415TV
DC10031516TD
BW1002 

 

So the count should be 2+1=3.
How can I implement this?

Regards,
Abhishek