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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

count matching

hi,

ı have a very simple question, that you might all know

ı have 2 tables

a , b

x , a

x , a

y , b

   , c

   , d

ı want to distinct count values in table b but only the matching ones ( a ,b)

when a basicly count(distinct ) values in table b, it counts all the values (a,b,c,d) but ı want just the matching ones with table a.

(the two tables are joined, no prblm)

thnks for any helps.

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

T1:

Load *,ID As ID_Cpy Inline [

ID

x

x

y

];

T2:

Load * Inline [

ID , ID1

x , a

x , a

y , b

   , c

   , d ];

=Count(DISTINCT If(Not(IsNull(ID_Cpy)),ID1))

View solution in original post

7 Replies
oknotsen
Master III
Master III

How about something like this:

=count( { < SomeField = SomeOtherField> } distinct SomeField)

May you live in interesting times!
Anonymous
Not applicable
Author

It does not solve.

The Two tables are already joined.

table a , table b

ID          ID    ID2

x ,          x ,   a

x ,          x,    a

y ,          y,    b

              z  ,  c

              t    , d

ı need the distinct count of column ID2 (matching ones)

Anonymous
Not applicable
Author

Any helps?

Not applicable
Author

If i understood your logic you need count result as 2 isn't it? or else

anbu1984
Master III
Master III

T1:

Load *,ID As ID_Cpy Inline [

ID

x

x

y

];

T2:

Load * Inline [

ID , ID1

x , a

x , a

y , b

   , c

   , d ];

=Count(DISTINCT If(Not(IsNull(ID_Cpy)),ID1))

anbu1984
Master III
Master III

T1:

Load *,ID As ID_Cpy Inline [

ID

x

x

y

];

T2:

Load * Inline [

ID , ID1

x , a

x , a

y , b

   , c

   , d ];

=Count(DISTINCT If(Not(IsNull(ID_Cpy)),ID1))

Anonymous
Not applicable
Author

=Count(DISTINCT If(Not(IsNull(ID_Cpy)),ID1))


that was all I need.

Thank you very much my friend.

for your help.