Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Not applicable

Same field in the two tables

Hi All,

I have two tables: Table1 and Table2. I have 4 fields in my Table2, and 21 fields in Table1.

I want to link the two tables based on a field that exist in Table2 and should be derived for records in Table1. I was able to do so by doing the following and it works. So the intention of the following is to derive the new field and add it to the Table1.

TestTable:

LOAD

Field1 & ' ' & Field2 as NewField,

[ID]

;

Load

  [ID],

  Field1,

  Field2

  Resident [Table1];

Join (Table1)

Load *

Resident TestTable;

Drop table TestTable;

So now my Table1 has 21 fields including the NewField.

Qlikview is now linking Table1 and Table 2 by the NewField.

The counts of values in NewField is different between the two tables. When I do the counts (to plot in pie charts, etc.) it counts NewField in Table2, and not Table1. I want to be able to perform the count on NewField in Table1. How can I do it?

Appreciate your help!

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Same field in the two tables

You shouldn't count a key field, the results are not defined (it may count table 1 records, or table 2 records or something else).

Only a distinct count is defined on a key field.

If you need to count the field, count another field in the table you are interested in, that shows a value in each record where your key field also shows a value.

Maybe

=Count(ID)

View solution in original post

1 Reply
Highlighted
MVP
MVP

Re: Same field in the two tables

You shouldn't count a key field, the results are not defined (it may count table 1 records, or table 2 records or something else).

Only a distinct count is defined on a key field.

If you need to count the field, count another field in the table you are interested in, that shows a value in each record where your key field also shows a value.

Maybe

=Count(ID)

View solution in original post