Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pivot Table from 2 different tables help

Hi there, I am very new to Qlik, I have successfully created an App that displays a Pivot Table of information from 2 different tables. I just have the "Companies" associated with each other but I am running into some problems.

In both of my tables I have a column that displays Customer or Non-Customer. I have the two columns labeled differently Table 1 (Customer 1 Column) and Table 2 (Customer 2 Column). Sometimes in table 1 it will say that the company is a customer, sometimes it will say it in table 2. Sometimes both tables say it and sometimes one table says it is a customer and the other table does't.

I want to be able to show in my pivot table all customers or non-customers but it only takes information from one table or the other. I tried to create an IF function to combine the columns but it is not working correctly.

I am very new and have very little to no knowledge on scripts and code. If someone could help I would much appreciate it!

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Hello Shane.

Can you please add some example of data which is in both tables? How are those structured? If you can also draft what result are you expecting to get that would help

I have a feeling you just need to concatenate both tables in QV, but you did not tell if those tables carry other information as well.

BR,

Kuba

View solution in original post

4 Replies
Not applicable
Author

Hello Shane.

Can you please add some example of data which is in both tables? How are those structured? If you can also draft what result are you expecting to get that would help

I have a feeling you just need to concatenate both tables in QV, but you did not tell if those tables carry other information as well.

BR,

Kuba

Not applicable
Author

Thanks for the help!

Both tables have different and same data. So for instance, I want to consolidate all the emails associated with the companies. In table 1 I have some emails and in table 2 I have the same, different or no emails.

Table 1 (Email Column) | Table 2 (Email Column) | Data I want to Show

jake@qlik.com              |                                        |   jake@qlik.com

                                    |  sam@qlik.com                 |   sam@qlik.com

jerry@qlik.com              |  jerry@qlik.com               |   jerry@qlik.com

alice@qlik.com              | sara@qlik.com                 |    alice@qlik.com

I hope this shows accurately and helps!

Not applicable
Author

Try below code:

Tab1:

LOAD * INLINE [

    CompanyID, email

    1,jake@qlik.com

    3,jerry@qlik.com

    4,alice@qlik.com

];

Join (Tab1)

Tab2:

LOAD * INLINE [

    CompanyID, email2

    2,sam@qlik.com

    3,jerry@qlik.com

    4,sara@qlik.com

];

Final:

LOAD

CompanyID,

IF(ISNULL(email) OR TRIM(email)='', email2, email) as email

RESIDENT Tab1;

DROP table Tab1;

Result:

Screen Shot 08-05-16 at 09.03 PM.PNG

BR,

Kuba

Not applicable
Author

While that would be awesome and work for those specific emails, will it work for every entry in the columns? I have close to 2000 rows of emails.