Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Count Key values from one table, but not all tables

I would like to count the number of distinct key value (AccountID) on one table (TableA), but not count the key values on another table (TableB).  I have attached a QVW to illustrate.  In TableA, there are 4 distinct AccountIDs, but when using count distinct, it returns 8, which is the distinct count across all tables that have an AccountID column.  I would like to retreive the distinct count from only TableA.  Any ideas?

Thanks!

1 Solution

Accepted Solutions

Re: Count Key values from one table, but not all tables

Hi Robert,

Please find the attachment for the solution.

Regards,

@vi

4 Replies
Employee
Employee

Re: Count Key values from one table, but not all tables

put a flag in each table with value of 1 and sum the appropriate in the UI.

so in the set analysis put flag=1 for the appropriate table when counting

hrlinder
Honored Contributor

Re: Count Key values from one table, but not all tables

both table are concatented into one table Holding all values. so 8 is the correct answer.

if you Need two table you have to define for table b

Table B

noconcatenate load  ...

but then you have the same field in two tables and the result will be the same.

to get only the values of table A you need to gibt AccountID a different Name than

in TableB!

TableA:
AccountID1

..

TableB:
AcountID2,

...

What is the Business issue? The current example makes no sense.

Re: Count Key values from one table, but not all tables

Hi Robert,

Please find the attachment for the solution.

Regards,

@vi

anbu1984
Honored Contributor III

Re: Count Key values from one table, but not all tables

Try this

Community Browser