Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
swuehl
MVP
MVP

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
swuehl
MVP
MVP

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)