Search code examples
qliksense

How to Link 2 Sheets that have the same fields


I am looking for some help with trying to link 2 sheets that have a number of Filters that I have setup but are both sitting in separate tables. The reason this is because I have a number of aggregated columns that are different for the 2 tables and want to keep this separately as I will be building more sheets as I go along.

The filters that are the same within the 2 sheets are the following:

we_date product manager patch

Through the data manager I managed to create an association between the 2 tables for we_date but from reading on this site and other searches on Google I can't make any associations between these tables and this is where I am stuck.

The 2 sheets will now allow me to filter using the we_date, but if I use the filters for product, manager or patch then nothing happens on my 2nd sheet as they are not linked.

Currently in my data load editor I have 2 sections of select queries like the following:

Table1

QUALIFY *;
w:
SELECT
*
FROM
table1
;
UNQUALIFY *;

Table2

QUALIFY *;
w_c:
SELECT
*
FROM
table2
;
UNQUALIFY *;

I would really appreciate if somebody could advise a fix on the issue I am having.


Solution

  • In Qlik, field names of identical values from different tables are automatically associated.

    When you're calling Qualify *, you're actually renaming all field names and explicitly saying NOT to associate.

    Take a look at the Qlik Sense documentation on Qualify *:

    The automatic join between fields with the same name in different tables can be suspended by means of the qualify statement, which qualifies the field name with its table name. If qualified, the field name(s) will be renamed when found in a table. The new name will be in the form of tablename.fieldname. Tablename is equivalent to the label of the current table, or, if no label exists, to the name appearing after from in LOAD and SELECT statements.


    We can use as to manually reassign field names.

    SELECT customer_id, private_info as "private_info_1", favorite_dog from table1;
    SELECT customer_id, private_info as "private_info_2", car from table2;
    

    Or, we can correctly use Qualify. Example:

    table1 and table2 have a customer_id field, and private_info field. We want customer_id field to be the associative value, and private_info to not be. We would use QUALIFY on private_info, which Qlik would then rename based on file name.

    QUALIFY private_info;
    SELECT * from table1;
    SELECT * from table2;
    

    The following field names would then be: customer_id (associated), and table1.private_info, and table2.private_info